public static bool FileReadAsyncComplete(SteamAPICall_t hReadCall, byte[] pvBuffer, uint cubToRead) {
			InteropHelp.TestIfAvailableClient();
			return NativeMethods.ISteamRemoteStorage_FileReadAsyncComplete(hReadCall, pvBuffer, cubToRead);
		}
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_Lobby: " + m_Lobby);
        GUILayout.EndArea();

        GUILayout.BeginVertical("box");
        m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33));

        GUILayout.Label("GetFavoriteGameCount() : " + SteamMatchmaking.GetFavoriteGameCount());

        {
            AppId_t AppID;
            uint    IP;
            ushort  ConnPort;
            ushort  QueryPort;
            uint    Flags;
            uint    LastPlayedOnServer;
            bool    ret = SteamMatchmaking.GetFavoriteGame(0, out AppID, out IP, out ConnPort, out QueryPort, out Flags, out LastPlayedOnServer);
            GUILayout.Label("GetFavoriteGame(0, out AppID, out IP, out ConnPort, out QueryPort, out Flags, out LastPlayedOnServer) : " + ret + " -- " + AppID + " -- " + IP + " -- " + ConnPort + " -- " + QueryPort + " -- " + Flags + " -- " + LastPlayedOnServer);
        }

        if (GUILayout.Button("AddFavoriteGame(TestConstants.Instance.k_AppId_TeamFortress2, TestConstants.k_IpAddress208_78_165_233, TestConstants.k_Port27015, TestConstants.k_Port27015, Constants.k_unFavoriteFlagFavorite, CurrentUnixTime)"))
        {
            uint CurrentUnixTime = (uint)(System.DateTime.UtcNow.Subtract(new System.DateTime(1970, 1, 1))).TotalSeconds;
            int  ret             = SteamMatchmaking.AddFavoriteGame(TestConstants.Instance.k_AppId_TeamFortress2, TestConstants.k_IpAddress208_78_165_233, TestConstants.k_Port27015, TestConstants.k_Port27015, Constants.k_unFavoriteFlagFavorite, CurrentUnixTime);
            print("SteamMatchmaking.AddFavoriteGame(" + TestConstants.Instance.k_AppId_TeamFortress2 + ", " + TestConstants.k_IpAddress208_78_165_233 + ", " + TestConstants.k_Port27015 + ", " + TestConstants.k_Port27015 + ", " + Constants.k_unFavoriteFlagFavorite + ", " + CurrentUnixTime + ") : " + ret);
        }

        if (GUILayout.Button("RemoveFavoriteGame(TestConstants.Instance.k_AppId_TeamFortress2, TestConstants.k_IpAddress208_78_165_233, TestConstants.k_Port27015, TestConstants.k_Port27015, Constants.k_unFavoriteFlagFavorite)"))
        {
            bool ret = SteamMatchmaking.RemoveFavoriteGame(TestConstants.Instance.k_AppId_TeamFortress2, TestConstants.k_IpAddress208_78_165_233, TestConstants.k_Port27015, TestConstants.k_Port27015, Constants.k_unFavoriteFlagFavorite);
            print("SteamMatchmaking.RemoveFavoriteGame(" + TestConstants.Instance.k_AppId_TeamFortress2 + ", " + TestConstants.k_IpAddress208_78_165_233 + ", " + TestConstants.k_Port27015 + ", " + TestConstants.k_Port27015 + ", " + Constants.k_unFavoriteFlagFavorite + ") : " + ret);
        }

        if (GUILayout.Button("RequestLobbyList()"))
        {
            SteamAPICall_t handle = SteamMatchmaking.RequestLobbyList();
            OnLobbyMatchListCallResult.Set(handle);
            print("SteamMatchmaking.RequestLobbyList() : " + handle);
        }

        if (GUILayout.Button("AddRequestLobbyListStringFilter(\"SomeStringKey\", \"SomeValue\", ELobbyComparison.k_ELobbyComparisonNotEqual)"))
        {
            SteamMatchmaking.AddRequestLobbyListStringFilter("SomeStringKey", "SomeValue", ELobbyComparison.k_ELobbyComparisonNotEqual);
            print("SteamMatchmaking.AddRequestLobbyListStringFilter(" + "\"SomeStringKey\"" + ", " + "\"SomeValue\"" + ", " + ELobbyComparison.k_ELobbyComparisonNotEqual + ")");
        }

        if (GUILayout.Button("AddRequestLobbyListNumericalFilter(\"SomeIntKey\", 0, ELobbyComparison.k_ELobbyComparisonNotEqual)"))
        {
            SteamMatchmaking.AddRequestLobbyListNumericalFilter("SomeIntKey", 0, ELobbyComparison.k_ELobbyComparisonNotEqual);
            print("SteamMatchmaking.AddRequestLobbyListNumericalFilter(" + "\"SomeIntKey\"" + ", " + 0 + ", " + ELobbyComparison.k_ELobbyComparisonNotEqual + ")");
        }

        if (GUILayout.Button("AddRequestLobbyListNearValueFilter(\"SomeIntKey\", 0)"))
        {
            SteamMatchmaking.AddRequestLobbyListNearValueFilter("SomeIntKey", 0);
            print("SteamMatchmaking.AddRequestLobbyListNearValueFilter(" + "\"SomeIntKey\"" + ", " + 0 + ")");
        }

        if (GUILayout.Button("AddRequestLobbyListFilterSlotsAvailable(3)"))
        {
            SteamMatchmaking.AddRequestLobbyListFilterSlotsAvailable(3);
            print("SteamMatchmaking.AddRequestLobbyListFilterSlotsAvailable(" + 3 + ")");
        }

        if (GUILayout.Button("AddRequestLobbyListDistanceFilter(ELobbyDistanceFilter.k_ELobbyDistanceFilterWorldwide)"))
        {
            SteamMatchmaking.AddRequestLobbyListDistanceFilter(ELobbyDistanceFilter.k_ELobbyDistanceFilterWorldwide);
            print("SteamMatchmaking.AddRequestLobbyListDistanceFilter(" + ELobbyDistanceFilter.k_ELobbyDistanceFilterWorldwide + ")");
        }

        if (GUILayout.Button("AddRequestLobbyListResultCountFilter(1)"))
        {
            SteamMatchmaking.AddRequestLobbyListResultCountFilter(1);
            print("SteamMatchmaking.AddRequestLobbyListResultCountFilter(" + 1 + ")");
        }

        if (GUILayout.Button("AddRequestLobbyListCompatibleMembersFilter((CSteamID)0)"))
        {
            SteamMatchmaking.AddRequestLobbyListCompatibleMembersFilter((CSteamID)0);
            print("SteamMatchmaking.AddRequestLobbyListCompatibleMembersFilter(" + (CSteamID)0 + ")");
        }

        if (GUILayout.Button("GetLobbyByIndex(0)"))
        {
            m_Lobby = SteamMatchmaking.GetLobbyByIndex(0);
            print("SteamMatchmaking.GetLobbyByIndex(" + 0 + ") : " + m_Lobby);
        }

        if (GUILayout.Button("CreateLobby(ELobbyType.k_ELobbyTypePublic, 1)"))
        {
            SteamAPICall_t handle = SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, 1);
            OnLobbyCreatedCallResult.Set(handle);
            print("SteamMatchmaking.CreateLobby(" + ELobbyType.k_ELobbyTypePublic + ", " + 1 + ") : " + handle);
        }

        if (GUILayout.Button("JoinLobby(m_Lobby)"))
        {
            SteamAPICall_t handle = SteamMatchmaking.JoinLobby(m_Lobby);
            OnLobbyEnterCallResult.Set(handle);
            print("SteamMatchmaking.JoinLobby(" + m_Lobby + ") : " + handle);
        }

        if (GUILayout.Button("LeaveLobby(m_Lobby)"))
        {
            SteamMatchmaking.LeaveLobby(m_Lobby);
            m_Lobby = CSteamID.Nil;
            print("SteamMatchmaking.LeaveLobby(" + m_Lobby + ")");
        }

        if (GUILayout.Button("InviteUserToLobby(m_Lobby, SteamUser.GetSteamID())"))
        {
            bool ret = SteamMatchmaking.InviteUserToLobby(m_Lobby, SteamUser.GetSteamID());
            print("SteamMatchmaking.InviteUserToLobby(" + m_Lobby + ", " + SteamUser.GetSteamID() + ") : " + ret);
        }

        GUILayout.Label("GetNumLobbyMembers(m_Lobby) : " + SteamMatchmaking.GetNumLobbyMembers(m_Lobby));

        GUILayout.Label("GetLobbyMemberByIndex(m_Lobby, 0) : " + SteamMatchmaking.GetLobbyMemberByIndex(m_Lobby, 0));

        GUILayout.Label("GetLobbyData(m_Lobby, \"name\") : " + SteamMatchmaking.GetLobbyData(m_Lobby, "name"));

        if (GUILayout.Button("SetLobbyData(m_Lobby, \"name\", \"Test Lobby!\")"))
        {
            bool ret = SteamMatchmaking.SetLobbyData(m_Lobby, "name", "Test Lobby!");
            print("SteamMatchmaking.SetLobbyData(" + m_Lobby + ", " + "\"name\"" + ", " + "\"Test Lobby!\"" + ") : " + ret);
        }

        GUILayout.Label("GetLobbyDataCount(m_Lobby) : " + SteamMatchmaking.GetLobbyDataCount(m_Lobby));

        {
            string Key;
            string Value;
            bool   ret = SteamMatchmaking.GetLobbyDataByIndex(m_Lobby, 0, out Key, 255, out Value, 255);
            GUILayout.Label("GetLobbyDataByIndex(m_Lobby, 0, out Key, 255, out Value, 255) : " + ret + " -- " + Key + " -- " + Value);
        }

        if (GUILayout.Button("DeleteLobbyData(m_Lobby, \"name\")"))
        {
            bool ret = SteamMatchmaking.DeleteLobbyData(m_Lobby, "name");
            print("SteamMatchmaking.DeleteLobbyData(" + m_Lobby + ", " + "\"name\"" + ") : " + ret);
        }

        GUILayout.Label("GetLobbyMemberData(m_Lobby, SteamUser.GetSteamID(), \"test\") : " + SteamMatchmaking.GetLobbyMemberData(m_Lobby, SteamUser.GetSteamID(), "test"));

        if (GUILayout.Button("SetLobbyMemberData(m_Lobby, \"test\", \"This is a test Key!\")"))
        {
            SteamMatchmaking.SetLobbyMemberData(m_Lobby, "test", "This is a test Key!");
            print("SteamMatchmaking.SetLobbyMemberData(" + m_Lobby + ", " + "\"test\"" + ", " + "\"This is a test Key!\"" + ")");
        }

        if (GUILayout.Button("SendLobbyChatMsg(m_Lobby, MsgBody, MsgBody.Length)"))
        {
            byte[] MsgBody = System.Text.Encoding.UTF8.GetBytes("Test Message!");
            bool   ret     = SteamMatchmaking.SendLobbyChatMsg(m_Lobby, MsgBody, MsgBody.Length);
            print("SteamMatchmaking.SendLobbyChatMsg(" + m_Lobby + ", " + MsgBody + ", " + MsgBody.Length + ") : " + ret);
        }

        //SteamMatchmaking.GetLobbyChatEntry() // Only called from within OnLobbyChatMsg!

        if (GUILayout.Button("RequestLobbyData(m_Lobby)"))
        {
            bool ret = SteamMatchmaking.RequestLobbyData(m_Lobby);
            print("SteamMatchmaking.RequestLobbyData(" + m_Lobby + ") : " + ret);
        }

        if (GUILayout.Button("SetLobbyGameServer(m_Lobby, TestConstants.k_IpAdress127_0_0_1, TestConstants.k_Port27015, CSteamID.NonSteamGS)"))
        {
            SteamMatchmaking.SetLobbyGameServer(m_Lobby, TestConstants.k_IpAdress127_0_0_1, TestConstants.k_Port27015, CSteamID.NonSteamGS);
            print("SteamMatchmaking.SetLobbyGameServer(" + m_Lobby + ", " + TestConstants.k_IpAdress127_0_0_1 + ", " + TestConstants.k_Port27015 + ", " + CSteamID.NonSteamGS + ")");
        }

        {
            uint     GameServerIP;
            ushort   GameServerPort;
            CSteamID SteamIDGameServer;
            bool     ret = SteamMatchmaking.GetLobbyGameServer(m_Lobby, out GameServerIP, out GameServerPort, out SteamIDGameServer);
            GUILayout.Label("GetLobbyGameServer(m_Lobby, out GameServerIP, out GameServerPort, out SteamIDGameServer) : " + ret + " -- " + GameServerIP + " -- " + GameServerPort + " -- " + SteamIDGameServer);
        }

        if (GUILayout.Button("SetLobbyMemberLimit(m_Lobby, 6)"))
        {
            bool ret = SteamMatchmaking.SetLobbyMemberLimit(m_Lobby, 6);
            print("SteamMatchmaking.SetLobbyMemberLimit(" + m_Lobby + ", " + 6 + ") : " + ret);
        }

        GUILayout.Label("GetLobbyMemberLimit(m_Lobby) : " + SteamMatchmaking.GetLobbyMemberLimit(m_Lobby));

        if (GUILayout.Button("SetLobbyType(m_Lobby, ELobbyType.k_ELobbyTypePublic)"))
        {
            bool ret = SteamMatchmaking.SetLobbyType(m_Lobby, ELobbyType.k_ELobbyTypePublic);
            print("SteamMatchmaking.SetLobbyType(" + m_Lobby + ", " + ELobbyType.k_ELobbyTypePublic + ") : " + ret);
        }

        if (GUILayout.Button("SetLobbyJoinable(m_Lobby, true)"))
        {
            bool ret = SteamMatchmaking.SetLobbyJoinable(m_Lobby, true);
            print("SteamMatchmaking.SetLobbyJoinable(" + m_Lobby + ", " + true + ") : " + ret);
        }

        if (GUILayout.Button("GetLobbyOwner(m_Lobby)"))
        {
            CSteamID ret = SteamMatchmaking.GetLobbyOwner(m_Lobby);
            print("SteamMatchmaking.GetLobbyOwner(" + m_Lobby + ") : " + ret);
        }

        if (GUILayout.Button("SetLobbyOwner(m_Lobby, SteamUser.GetSteamID())"))
        {
            bool ret = SteamMatchmaking.SetLobbyOwner(m_Lobby, SteamUser.GetSteamID());
            print("SteamMatchmaking.SetLobbyOwner(" + m_Lobby + ", " + SteamUser.GetSteamID() + ") : " + ret);
        }

        if (GUILayout.Button("SetLinkedLobby(m_Lobby, m_Lobby)"))
        {
            bool ret = SteamMatchmaking.SetLinkedLobby(m_Lobby, m_Lobby);
            print("SteamMatchmaking.SetLinkedLobby(" + m_Lobby + ", " + m_Lobby + ") : " + ret);
        }

        //SteamMatchmaking.CheckForPSNGameBootInvite() // PS3 Only.

        GUILayout.EndScrollView();
        GUILayout.EndVertical();
    }
Beispiel #3
0
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 120, 0, 120, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_UGCQueryHandle: " + m_UGCQueryHandle);
        GUILayout.Label("m_PublishedFileId: " + m_PublishedFileId);
        GUILayout.Label("m_UGCUpdateHandle: " + m_UGCUpdateHandle);
        GUILayout.EndArea();

        if (GUILayout.Button("CreateQueryUserUGCRequest(SteamUser.GetSteamID().GetAccountID(), EUserUGCList.k_EUserUGCList_Published, EUGCMatchingUGCType.k_EUGCMatchingUGCType_Screenshots, EUserUGCListSortOrder.k_EUserUGCListSortOrder_CreationOrderDesc, AppId_t.Invalid, SteamUtils.GetAppID(), 1)"))
        {
            m_UGCQueryHandle = SteamUGC.CreateQueryUserUGCRequest(SteamUser.GetSteamID().GetAccountID(), EUserUGCList.k_EUserUGCList_Published, EUGCMatchingUGCType.k_EUGCMatchingUGCType_Screenshots, EUserUGCListSortOrder.k_EUserUGCListSortOrder_CreationOrderDesc, AppId_t.Invalid, SteamUtils.GetAppID(), 1);
            print("SteamUGC.CreateQueryUserUGCRequest(" + SteamUser.GetSteamID().GetAccountID() + ", EUserUGCList.k_EUserUGCList_Published, EUGCMatchingUGCType.k_EUGCMatchingUGCType_Screenshots, EUserUGCListSortOrder.k_EUserUGCListSortOrder_CreationOrderDesc, " + AppId_t.Invalid + ", " + SteamUtils.GetAppID() + ", 1) : " + m_UGCQueryHandle);
        }

        if (GUILayout.Button("CreateQueryAllUGCRequest(EUGCQuery.k_EUGCQuery_RankedByPublicationDate, EUGCMatchingUGCType.k_EUGCMatchingUGCType_AllGuides, AppId_t.Invalid, SteamUtils.GetAppID(), 1)"))
        {
            m_UGCQueryHandle = SteamUGC.CreateQueryAllUGCRequest(EUGCQuery.k_EUGCQuery_RankedByPublicationDate, EUGCMatchingUGCType.k_EUGCMatchingUGCType_AllGuides, AppId_t.Invalid, SteamUtils.GetAppID(), 1);
            print("SteamUGC.CreateQueryAllUGCRequest(EUGCQuery.k_EUGCQuery_RankedByPublicationDate, EUGCMatchingUGCType.k_EUGCMatchingUGCType_AllGuides, " + AppId_t.Invalid + ", " + SteamUtils.GetAppID() + ", 1) : " + m_UGCQueryHandle);
        }

        if (GUILayout.Button("SendQueryUGCRequest(m_UGCQueryHandle)"))
        {
            SteamAPICall_t handle = SteamUGC.SendQueryUGCRequest(m_UGCQueryHandle);
            OnSteamUGCQueryCompletedCallResult.Set(handle);
            print("SteamUGC.SendQueryUGCRequest(" + m_UGCQueryHandle + ") : " + handle);
        }

        if (GUILayout.Button("GetQueryUGCResult(m_UGCQueryHandle, 0, out Details)"))
        {
            SteamUGCDetails_t Details;
            bool ret = SteamUGC.GetQueryUGCResult(m_UGCQueryHandle, 0, out Details);
            print("SteamUGC.GetQueryUGCResult(" + m_UGCQueryHandle + ", 0, out Details) : " + ret);
            print(Details.m_nPublishedFileId + " -- " + Details.m_eResult + " -- " + Details.m_eFileType + " -- " + Details.m_nCreatorAppID + " -- " + Details.m_nConsumerAppID + " -- " + Details.m_rgchTitle + " -- " + Details.m_rgchDescription + " -- " + Details.m_ulSteamIDOwner + " -- " + Details.m_rtimeCreated + " -- " + Details.m_rtimeUpdated + " -- " + Details.m_rtimeAddedToUserList + " -- " + Details.m_eVisibility + " -- " + Details.m_bBanned + " -- " + Details.m_bAcceptedForUse + " -- " + Details.m_bTagsTruncated + " -- " + Details.m_rgchTags + " -- " + Details.m_hFile + " -- " + Details.m_hPreviewFile + " -- " + Details.m_pchFileName + " -- " + Details.m_nFileSize + " -- " + Details.m_nPreviewFileSize + " -- " + Details.m_rgchURL + " -- " + Details.m_unVotesUp + " -- " + Details.m_unVotesDown + " -- " + Details.m_flScore + " -- " + Details.m_unNumChildren);
        }

        if (GUILayout.Button("ReleaseQueryUGCRequest(m_UGCQueryHandle)"))
        {
            print("SteamUGC.ReleaseQueryUGCRequest(" + m_UGCQueryHandle + ") : " + SteamUGC.ReleaseQueryUGCRequest(m_UGCQueryHandle));
        }

        if (GUILayout.Button("AddRequiredTag(m_UGCQueryHandle, \"Co-op\")"))
        {
            print("SteamUGC.AddRequiredTag(" + m_UGCQueryHandle + ", \"Co-op\") : " + SteamUGC.AddRequiredTag(m_UGCQueryHandle, "Co-op"));
        }

        if (GUILayout.Button("AddExcludedTag(m_UGCQueryHandle, \"Co-op\")"))
        {
            print("SteamUGC.AddExcludedTag(" + m_UGCQueryHandle + ", \"Co-op\") : " + SteamUGC.AddExcludedTag(m_UGCQueryHandle, "Co-op"));
        }

        if (GUILayout.Button("SetReturnLongDescription(m_UGCQueryHandle, true)"))
        {
            print("SteamUGC.SetReturnLongDescription(" + m_UGCQueryHandle + ", true) : " + SteamUGC.SetReturnLongDescription(m_UGCQueryHandle, true));
        }

        if (GUILayout.Button("SetReturnTotalOnly(m_UGCQueryHandle, true)"))
        {
            print("SteamUGC.SetReturnTotalOnly(" + m_UGCQueryHandle + ", true) : " + SteamUGC.SetReturnTotalOnly(m_UGCQueryHandle, true));
        }

        if (GUILayout.Button("SetAllowCachedResponse(m_UGCQueryHandle, 5)"))
        {
            print("SteamUGC.SetAllowCachedResponse(" + m_UGCQueryHandle + ", 5) : " + SteamUGC.SetAllowCachedResponse(m_UGCQueryHandle, 5));
        }

        if (GUILayout.Button("SetCloudFileNameFilter(m_UGCQueryHandle, \"\")"))
        {
            print("SteamUGC.SetCloudFileNameFilter(" + m_UGCQueryHandle + ", \"\") : " + SteamUGC.SetCloudFileNameFilter(m_UGCQueryHandle, ""));
        }

        if (GUILayout.Button("SetMatchAnyTag(m_UGCQueryHandle, true)"))
        {
            print("SteamUGC.SetMatchAnyTag(" + m_UGCQueryHandle + ", true) : " + SteamUGC.SetMatchAnyTag(m_UGCQueryHandle, true));
        }

        if (GUILayout.Button("SetSearchText(m_UGCQueryHandle, \"AciD\")"))
        {
            print("SteamUGC.SetSearchText(" + m_UGCQueryHandle + ", \"AciD\") : " + SteamUGC.SetSearchText(m_UGCQueryHandle, "AciD"));
        }

        if (GUILayout.Button("SetRankedByTrendDays(m_UGCQueryHandle, 7)"))
        {
            print("SteamUGC.SetRankedByTrendDays(" + m_UGCQueryHandle + ", 7) : " + SteamUGC.SetRankedByTrendDays(m_UGCQueryHandle, 7));
        }

        if (GUILayout.Button("RequestUGCDetails(m_PublishedFileId, 5)"))
        {
            SteamAPICall_t handle = SteamUGC.RequestUGCDetails(m_PublishedFileId, 5);
            OnSteamUGCRequestUGCDetailsResultCallResult.Set(handle);
            print("SteamUGC.RequestUGCDetails(m_PublishedFileId, 5) : " + handle);
        }

        if (GUILayout.Button("CreateItem((AppId_t)480, EWorkshopFileType.k_EWorkshopFileTypeWebGuide)"))
        {
            SteamAPICall_t handle = SteamUGC.CreateItem((AppId_t)480, EWorkshopFileType.k_EWorkshopFileTypeWebGuide);
            OnCreateItemResultCallResult.Set(handle);
            print("SteamUGC.CreateItem((AppId_t)480, EWorkshopFileType.k_EWorkshopFileTypeWebGuide) : " + handle);
        }

        if (GUILayout.Button("StartItemUpdate((AppId_t)480, m_PublishedFileId)"))
        {
            m_UGCUpdateHandle = SteamUGC.StartItemUpdate((AppId_t)480, m_PublishedFileId);
            print("SteamUGC.StartItemUpdate((AppId_t)480, " + m_PublishedFileId + ") : " + m_UGCUpdateHandle);
        }

        if (GUILayout.Button("SetItemTitle(m_UGCUpdateHandle, \"This is a Test\")"))
        {
            bool ret = SteamUGC.SetItemTitle(m_UGCUpdateHandle, "This is a Test");
            print("SteamUGC.SetItemTitle(" + m_UGCUpdateHandle + ", \"This is a Test\") : " + ret);
        }

        if (GUILayout.Button("SetItemDescription(m_UGCUpdateHandle, \"This is the test description.\")"))
        {
            bool ret = SteamUGC.SetItemDescription(m_UGCUpdateHandle, "This is the test description.");
            print("SteamUGC.SetItemDescription(" + m_UGCUpdateHandle + ", \"This is the test description.\") : " + ret);
        }

        if (GUILayout.Button("SetItemVisibility(m_UGCUpdateHandle, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate)"))
        {
            bool ret = SteamUGC.SetItemVisibility(m_UGCUpdateHandle, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate);
            print("SteamUGC.SetItemVisibility(" + m_UGCUpdateHandle + ", ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate) : " + ret);
        }

        if (GUILayout.Button("SetItemTags(m_UGCUpdateHandle, new string[] {\"Tag One\", \"Tag Two\", \"Test Tags\", \"Sorry\"})"))
        {
            bool ret = SteamUGC.SetItemTags(m_UGCUpdateHandle, new string[] { "Tag One", "Tag Two", "Test Tags", "Sorry" });
            print("SteamUGC.SetItemTags(" + m_UGCUpdateHandle + ", new string[] {\"Tag One\", \"Tag Two\", \"Test Tags\", \"Sorry\"}) : " + ret);
        }

        if (GUILayout.Button("SetItemContent(m_UGCUpdateHandle, Application.dataPath + \"/Scenes\")"))
        {
            bool ret = SteamUGC.SetItemContent(m_UGCUpdateHandle, Application.dataPath + "/Scenes");             // Should point to a folder containing the UGC Item
            print("SteamUGC.SetItemContent(" + m_UGCUpdateHandle + ", Application.dataPath + \"/Scenes\") : " + ret);
        }

        if (GUILayout.Button("SetItemPreview(m_UGCUpdateHandle, Application.dataPath + \"/controller.vdf\")"))
        {
            bool ret = SteamUGC.SetItemPreview(m_UGCUpdateHandle, Application.dataPath + "/controller.vdf");             // Should actually be a PNG/JPG Screenshot.
            print("SteamUGC.SetItemPreview(" + m_UGCUpdateHandle + ", Application.dataPath + \"/controller.vdf\") : " + ret);
        }

        if (GUILayout.Button("SubmitItemUpdate(m_UGCUpdateHandle, \"Test Changenote\")"))
        {
            SteamAPICall_t handle = SteamUGC.SubmitItemUpdate(m_UGCUpdateHandle, "Test Changenote");
            OnSubmitItemUpdateResultCallResult.Set(handle);
            print("SteamUGC.SubmitItemUpdate(" + m_UGCUpdateHandle + ", \"Test Changenote\") : " + handle);
        }

        {
            ulong             BytesProcessed;
            ulong             BytesTotal;
            EItemUpdateStatus ret = SteamUGC.GetItemUpdateProgress(m_UGCUpdateHandle, out BytesProcessed, out BytesTotal);
            GUILayout.Label("GetItemUpdateProgress(m_UGCUpdateHandle, out BytesProcessed, out BytesTotal) : " + ret + " -- " + BytesProcessed + " -- " + BytesTotal);
        }

        if (GUILayout.Button("SubscribeItem((PublishedFileId_t)113142309)"))
        {
            SteamAPICall_t handle = SteamUGC.SubscribeItem((PublishedFileId_t)113142309);             // http://steamcommunity.com/sharedfiles/filedetails/?id=113142309
            OnRemoteStorageSubscribePublishedFileResultCallResult.Set(handle);
            print("SteamUGC. : " + handle);
        }

        if (GUILayout.Button("UnsubscribeItem((PublishedFileId_t)113142309)"))
        {
            SteamAPICall_t handle = SteamUGC.UnsubscribeItem((PublishedFileId_t)113142309);             // http://steamcommunity.com/sharedfiles/filedetails/?id=113142309
            OnRemoteStorageUnsubscribePublishedFileResultCallResult.Set(handle);
            print("SteamUGC. : " + handle);
        }

        GUILayout.Label("GetNumSubscribedItems() : " + SteamUGC.GetNumSubscribedItems());

        if (GUILayout.Button("GetSubscribedItems(PublishedFileID, (uint)PublishedFileID.Length)"))
        {
            PublishedFileId_t[] PublishedFileID = new PublishedFileId_t[1];
            uint ret = SteamUGC.GetSubscribedItems(PublishedFileID, (uint)PublishedFileID.Length);
            m_PublishedFileId = PublishedFileID[0];
            print("SteamUGC.GetSubscribedItems(" + PublishedFileID + ", (uint)PublishedFileID.Length) : " + ret + " -- " + PublishedFileID[0]);
        }

        {
            ulong  SizeOnDisk;
            string Folder;
            bool   LegacyItem;
            bool   ret = SteamUGC.GetItemInstallInfo(m_PublishedFileId, out SizeOnDisk, out Folder, 1024, out LegacyItem);
            GUILayout.Label("GetItemInstallInfo(m_PublishedFileId, out SizeOnDisk, out Folder, 1024) : " + ret + " -- " + SizeOnDisk + " -- " + Folder + " -- " + LegacyItem);
        }

        {
            bool  NeedsUpdate;
            bool  IsDownloading;
            ulong BytesDownloaded;
            ulong BytesTotal;
            bool  ret = SteamUGC.GetItemUpdateInfo(m_PublishedFileId, out NeedsUpdate, out IsDownloading, out BytesDownloaded, out BytesTotal);
            GUILayout.Label("GetItemUpdateInfo(m_PublishedFileId, out NeedsUpdate, out IsDownloading, out BytesDownloaded, out BytesTotal) : " + ret + " -- " + NeedsUpdate + " -- " + IsDownloading + " -- " + BytesDownloaded + " -- " + BytesTotal);
        }
    }
Beispiel #4
0
        internal static void OpenServerBrowser()
        {
            SteamAPICall_t handle = SteamMatchmaking.RequestLobbyList();

            callr.Set(handle);
        }
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_UGCQueryHandle: " + m_UGCQueryHandle);
        GUILayout.Label("m_PublishedFileId: " + m_PublishedFileId);
        GUILayout.Label("m_UGCUpdateHandle: " + m_UGCUpdateHandle);
        GUILayout.EndArea();

        GUILayout.BeginVertical("box");
        m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33));

        if (GUILayout.Button("CreateQueryUserUGCRequest(SteamUser.GetSteamID().GetAccountID(), EUserUGCList.k_EUserUGCList_Published, EUGCMatchingUGCType.k_EUGCMatchingUGCType_Screenshots, EUserUGCListSortOrder.k_EUserUGCListSortOrder_CreationOrderDesc, AppId_t.Invalid, SteamUtils.GetAppID(), 1)"))
        {
            m_UGCQueryHandle = SteamUGC.CreateQueryUserUGCRequest(SteamUser.GetSteamID().GetAccountID(), EUserUGCList.k_EUserUGCList_Published, EUGCMatchingUGCType.k_EUGCMatchingUGCType_Screenshots, EUserUGCListSortOrder.k_EUserUGCListSortOrder_CreationOrderDesc, AppId_t.Invalid, SteamUtils.GetAppID(), 1);
            print("SteamUGC.CreateQueryUserUGCRequest(" + SteamUser.GetSteamID().GetAccountID() + ", " + EUserUGCList.k_EUserUGCList_Published + ", " + EUGCMatchingUGCType.k_EUGCMatchingUGCType_Screenshots + ", " + EUserUGCListSortOrder.k_EUserUGCListSortOrder_CreationOrderDesc + ", " + AppId_t.Invalid + ", " + SteamUtils.GetAppID() + ", " + 1 + ") : " + m_UGCQueryHandle);
        }

        if (GUILayout.Button("CreateQueryAllUGCRequest(EUGCQuery.k_EUGCQuery_RankedByPublicationDate, EUGCMatchingUGCType.k_EUGCMatchingUGCType_Items, AppId_t.Invalid, SteamUtils.GetAppID(), 1)"))
        {
            m_UGCQueryHandle = SteamUGC.CreateQueryAllUGCRequest(EUGCQuery.k_EUGCQuery_RankedByPublicationDate, EUGCMatchingUGCType.k_EUGCMatchingUGCType_Items, AppId_t.Invalid, SteamUtils.GetAppID(), 1);
            print("SteamUGC.CreateQueryAllUGCRequest(" + EUGCQuery.k_EUGCQuery_RankedByPublicationDate + ", " + EUGCMatchingUGCType.k_EUGCMatchingUGCType_Items + ", " + AppId_t.Invalid + ", " + SteamUtils.GetAppID() + ", " + 1 + ") : " + m_UGCQueryHandle);
        }

        if (GUILayout.Button("CreateQueryUGCDetailsRequest(PublishedFileIDs, (uint)PublishedFileIDs.Length)"))
        {
            PublishedFileId_t[] PublishedFileIDs = new PublishedFileId_t[] { TestConstants.Instance.k_PublishedFileId_Champions };
            m_UGCQueryHandle = SteamUGC.CreateQueryUGCDetailsRequest(PublishedFileIDs, (uint)PublishedFileIDs.Length);
            print("SteamUGC.CreateQueryUGCDetailsRequest(" + PublishedFileIDs + ", " + (uint)PublishedFileIDs.Length + ") : " + m_UGCQueryHandle);
        }

        if (GUILayout.Button("SendQueryUGCRequest(m_UGCQueryHandle)"))
        {
            SteamAPICall_t handle = SteamUGC.SendQueryUGCRequest(m_UGCQueryHandle);
            OnSteamUGCQueryCompletedCallResult.Set(handle);
            print("SteamUGC.SendQueryUGCRequest(" + m_UGCQueryHandle + ") : " + handle);
        }

        if (GUILayout.Button("GetQueryUGCResult(m_UGCQueryHandle, 0, out Details)"))
        {
            SteamUGCDetails_t Details;
            bool ret = SteamUGC.GetQueryUGCResult(m_UGCQueryHandle, 0, out Details);
            print(Details.m_nPublishedFileId + " -- " + Details.m_eResult + " -- " + Details.m_eFileType + " -- " + Details.m_nCreatorAppID + " -- " + Details.m_nConsumerAppID + " -- " + Details.m_rgchTitle + " -- " + Details.m_rgchDescription + " -- " + Details.m_ulSteamIDOwner + " -- " + Details.m_rtimeCreated + " -- " + Details.m_rtimeUpdated + " -- " + Details.m_rtimeAddedToUserList + " -- " + Details.m_eVisibility + " -- " + Details.m_bBanned + " -- " + Details.m_bAcceptedForUse + " -- " + Details.m_bTagsTruncated + " -- " + Details.m_rgchTags + " -- " + Details.m_hFile + " -- " + Details.m_hPreviewFile + " -- " + Details.m_pchFileName + " -- " + Details.m_nFileSize + " -- " + Details.m_nPreviewFileSize + " -- " + Details.m_rgchURL + " -- " + Details.m_unVotesUp + " -- " + Details.m_unVotesDown + " -- " + Details.m_flScore + " -- " + Details.m_unNumChildren);
            print("SteamUGC.GetQueryUGCResult(" + m_UGCQueryHandle + ", " + 0 + ", " + "out Details" + ") : " + ret + " -- " + Details);
        }

        if (GUILayout.Button("GetQueryUGCPreviewURL(m_UGCQueryHandle, 0, out URL, 1024)"))
        {
            string URL;
            bool   ret = SteamUGC.GetQueryUGCPreviewURL(m_UGCQueryHandle, 0, out URL, 1024);
            print("SteamUGC.GetQueryUGCPreviewURL(" + m_UGCQueryHandle + ", " + 0 + ", " + "out URL" + ", " + 1024 + ") : " + ret + " -- " + URL);
        }

        if (GUILayout.Button("GetQueryUGCMetadata(m_UGCQueryHandle, 0, out Metadata, Constants.k_cchDeveloperMetadataMax)"))
        {
            string Metadata;
            bool   ret = SteamUGC.GetQueryUGCMetadata(m_UGCQueryHandle, 0, out Metadata, Constants.k_cchDeveloperMetadataMax);
            print("SteamUGC.GetQueryUGCMetadata(" + m_UGCQueryHandle + ", " + 0 + ", " + "out Metadata" + ", " + Constants.k_cchDeveloperMetadataMax + ") : " + ret + " -- " + Metadata);
        }

        if (GUILayout.Button("GetQueryUGCChildren(m_UGCQueryHandle, 0, PublishedFileIDs, (uint)PublishedFileIDs.Length)"))
        {
            PublishedFileId_t[] PublishedFileIDs = new PublishedFileId_t[1];             // Use SteamUGCDetails_t.m_unNumChildren instead...
            bool ret = SteamUGC.GetQueryUGCChildren(m_UGCQueryHandle, 0, PublishedFileIDs, (uint)PublishedFileIDs.Length);
            print("SteamUGC.GetQueryUGCChildren(" + m_UGCQueryHandle + ", " + 0 + ", " + PublishedFileIDs + ", " + (uint)PublishedFileIDs.Length + ") : " + ret);
        }

        if (GUILayout.Button("GetQueryUGCStatistic(m_UGCQueryHandle, 0, EItemStatistic.k_EItemStatistic_NumSubscriptions, out StatValue)"))
        {
            ulong StatValue;
            bool  ret = SteamUGC.GetQueryUGCStatistic(m_UGCQueryHandle, 0, EItemStatistic.k_EItemStatistic_NumSubscriptions, out StatValue);
            print("SteamUGC.GetQueryUGCStatistic(" + m_UGCQueryHandle + ", " + 0 + ", " + EItemStatistic.k_EItemStatistic_NumSubscriptions + ", " + "out StatValue" + ") : " + ret + " -- " + StatValue);
        }

        if (GUILayout.Button("GetQueryUGCNumAdditionalPreviews(m_UGCQueryHandle, 0)"))
        {
            uint ret = SteamUGC.GetQueryUGCNumAdditionalPreviews(m_UGCQueryHandle, 0);
            print("SteamUGC.GetQueryUGCNumAdditionalPreviews(" + m_UGCQueryHandle + ", " + 0 + ") : " + ret);
        }

        if (GUILayout.Button("GetQueryUGCAdditionalPreview(m_UGCQueryHandle, 0, 0, out pchURLOrVideoID, 1024, out pchOriginalFileName, 260, out pPreviewType)"))
        {
            // Should check GetQueryUGCNumAdditionalPreviews first.
            string           pchURLOrVideoID;
            string           pchOriginalFileName;
            EItemPreviewType pPreviewType;
            bool             ret = SteamUGC.GetQueryUGCAdditionalPreview(m_UGCQueryHandle, 0, 0, out pchURLOrVideoID, 1024, out pchOriginalFileName, 260, out pPreviewType);
            print("SteamUGC.GetQueryUGCAdditionalPreview(" + m_UGCQueryHandle + ", " + 0 + ", " + 0 + ", " + "out pchURLOrVideoID" + ", " + 1024 + ", " + "out pchOriginalFileName" + ", " + 260 + ", " + "out pPreviewType" + ") : " + ret + " -- " + pchURLOrVideoID + " -- " + pchOriginalFileName + " -- " + pPreviewType);
        }

        if (GUILayout.Button("GetQueryUGCNumKeyValueTags(m_UGCQueryHandle, 0)"))
        {
            uint ret = SteamUGC.GetQueryUGCNumKeyValueTags(m_UGCQueryHandle, 0);
            print("SteamUGC.GetQueryUGCNumKeyValueTags(" + m_UGCQueryHandle + ", " + 0 + ") : " + ret);
        }

        if (GUILayout.Button("GetQueryUGCKeyValueTag(m_UGCQueryHandle, 0, 0, out Key, 260, out Value, 260)"))
        {
            string Key;
            string Value;
            bool   ret = SteamUGC.GetQueryUGCKeyValueTag(m_UGCQueryHandle, 0, 0, out Key, 260, out Value, 260);
            print("SteamUGC.GetQueryUGCKeyValueTag(" + m_UGCQueryHandle + ", " + 0 + ", " + 0 + ", " + "out Key" + ", " + 260 + ", " + "out Value" + ", " + 260 + ") : " + ret + " -- " + Key + " -- " + Value);
        }

        if (GUILayout.Button("ReleaseQueryUGCRequest(m_UGCQueryHandle)"))
        {
            bool ret = SteamUGC.ReleaseQueryUGCRequest(m_UGCQueryHandle);
            print("SteamUGC.ReleaseQueryUGCRequest(" + m_UGCQueryHandle + ") : " + ret);
        }

        if (GUILayout.Button("AddRequiredTag(m_UGCQueryHandle, \"Co-op\")"))
        {
            bool ret = SteamUGC.AddRequiredTag(m_UGCQueryHandle, "Co-op");
            print("SteamUGC.AddRequiredTag(" + m_UGCQueryHandle + ", " + "\"Co-op\"" + ") : " + ret);
        }

        if (GUILayout.Button("AddExcludedTag(m_UGCQueryHandle, \"Co-op\")"))
        {
            bool ret = SteamUGC.AddExcludedTag(m_UGCQueryHandle, "Co-op");
            print("SteamUGC.AddExcludedTag(" + m_UGCQueryHandle + ", " + "\"Co-op\"" + ") : " + ret);
        }

        if (GUILayout.Button("SetReturnOnlyIDs(m_UGCQueryHandle, true)"))
        {
            bool ret = SteamUGC.SetReturnOnlyIDs(m_UGCQueryHandle, true);
            print("SteamUGC.SetReturnOnlyIDs(" + m_UGCQueryHandle + ", " + true + ") : " + ret);
        }

        if (GUILayout.Button("SetReturnKeyValueTags(m_UGCQueryHandle, true)"))
        {
            bool ret = SteamUGC.SetReturnKeyValueTags(m_UGCQueryHandle, true);
            print("SteamUGC.SetReturnKeyValueTags(" + m_UGCQueryHandle + ", " + true + ") : " + ret);
        }

        if (GUILayout.Button("SetReturnLongDescription(m_UGCQueryHandle, true)"))
        {
            bool ret = SteamUGC.SetReturnLongDescription(m_UGCQueryHandle, true);
            print("SteamUGC.SetReturnLongDescription(" + m_UGCQueryHandle + ", " + true + ") : " + ret);
        }

        if (GUILayout.Button("SetReturnMetadata(m_UGCQueryHandle, true)"))
        {
            bool ret = SteamUGC.SetReturnMetadata(m_UGCQueryHandle, true);
            print("SteamUGC.SetReturnMetadata(" + m_UGCQueryHandle + ", " + true + ") : " + ret);
        }

        if (GUILayout.Button("SetReturnChildren(m_UGCQueryHandle, true)"))
        {
            bool ret = SteamUGC.SetReturnChildren(m_UGCQueryHandle, true);
            print("SteamUGC.SetReturnChildren(" + m_UGCQueryHandle + ", " + true + ") : " + ret);
        }

        if (GUILayout.Button("SetReturnAdditionalPreviews(m_UGCQueryHandle, true)"))
        {
            bool ret = SteamUGC.SetReturnAdditionalPreviews(m_UGCQueryHandle, true);
            print("SteamUGC.SetReturnAdditionalPreviews(" + m_UGCQueryHandle + ", " + true + ") : " + ret);
        }

        if (GUILayout.Button("SetReturnTotalOnly(m_UGCQueryHandle, true)"))
        {
            bool ret = SteamUGC.SetReturnTotalOnly(m_UGCQueryHandle, true);
            print("SteamUGC.SetReturnTotalOnly(" + m_UGCQueryHandle + ", " + true + ") : " + ret);
        }

        if (GUILayout.Button("SetReturnPlaytimeStats(m_UGCQueryHandle, 7)"))
        {
            bool ret = SteamUGC.SetReturnPlaytimeStats(m_UGCQueryHandle, 7);
            print("SteamUGC.SetReturnPlaytimeStats(" + m_UGCQueryHandle + ", " + 7 + ") : " + ret);
        }

        if (GUILayout.Button("SetLanguage(m_UGCQueryHandle, \"english\")"))
        {
            bool ret = SteamUGC.SetLanguage(m_UGCQueryHandle, "english");
            print("SteamUGC.SetLanguage(" + m_UGCQueryHandle + ", " + "\"english\"" + ") : " + ret);
        }

        if (GUILayout.Button("SetAllowCachedResponse(m_UGCQueryHandle, 5)"))
        {
            bool ret = SteamUGC.SetAllowCachedResponse(m_UGCQueryHandle, 5);
            print("SteamUGC.SetAllowCachedResponse(" + m_UGCQueryHandle + ", " + 5 + ") : " + ret);
        }

        if (GUILayout.Button("SetCloudFileNameFilter(m_UGCQueryHandle, \"\")"))
        {
            bool ret = SteamUGC.SetCloudFileNameFilter(m_UGCQueryHandle, "");
            print("SteamUGC.SetCloudFileNameFilter(" + m_UGCQueryHandle + ", " + "\"\"" + ") : " + ret);
        }

        if (GUILayout.Button("SetMatchAnyTag(m_UGCQueryHandle, true)"))
        {
            bool ret = SteamUGC.SetMatchAnyTag(m_UGCQueryHandle, true);
            print("SteamUGC.SetMatchAnyTag(" + m_UGCQueryHandle + ", " + true + ") : " + ret);
        }

        if (GUILayout.Button("SetSearchText(m_UGCQueryHandle, \"Test\")"))
        {
            bool ret = SteamUGC.SetSearchText(m_UGCQueryHandle, "Test");
            print("SteamUGC.SetSearchText(" + m_UGCQueryHandle + ", " + "\"Test\"" + ") : " + ret);
        }

        if (GUILayout.Button("SetRankedByTrendDays(m_UGCQueryHandle, 7)"))
        {
            bool ret = SteamUGC.SetRankedByTrendDays(m_UGCQueryHandle, 7);
            print("SteamUGC.SetRankedByTrendDays(" + m_UGCQueryHandle + ", " + 7 + ") : " + ret);
        }

        if (GUILayout.Button("AddRequiredKeyValueTag(m_UGCQueryHandle, \"TestKey\", \"TestValue\")"))
        {
            bool ret = SteamUGC.AddRequiredKeyValueTag(m_UGCQueryHandle, "TestKey", "TestValue");
            print("SteamUGC.AddRequiredKeyValueTag(" + m_UGCQueryHandle + ", " + "\"TestKey\"" + ", " + "\"TestValue\"" + ") : " + ret);
        }

        if (GUILayout.Button("RequestUGCDetails(m_PublishedFileId, 5)"))
        {
            SteamAPICall_t handle = SteamUGC.RequestUGCDetails(m_PublishedFileId, 5);
            OnSteamUGCRequestUGCDetailsResultCallResult.Set(handle);
            print("SteamUGC.RequestUGCDetails(" + m_PublishedFileId + ", " + 5 + ") : " + handle);
        }

        if (GUILayout.Button("CreateItem(SteamUtils.GetAppID(), EWorkshopFileType.k_EWorkshopFileTypeCommunity)"))
        {
            SteamAPICall_t handle = SteamUGC.CreateItem(SteamUtils.GetAppID(), EWorkshopFileType.k_EWorkshopFileTypeCommunity);
            OnCreateItemResultCallResult.Set(handle);
            print("SteamUGC.CreateItem(" + SteamUtils.GetAppID() + ", " + EWorkshopFileType.k_EWorkshopFileTypeCommunity + ") : " + handle);
        }

        if (GUILayout.Button("StartItemUpdate(SteamUtils.GetAppID(), m_PublishedFileId)"))
        {
            m_UGCUpdateHandle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), m_PublishedFileId);
            print("SteamUGC.StartItemUpdate(" + SteamUtils.GetAppID() + ", " + m_PublishedFileId + ") : " + m_UGCUpdateHandle);
        }

        if (GUILayout.Button("SetItemTitle(m_UGCUpdateHandle, \"This is a Test\")"))
        {
            bool ret = SteamUGC.SetItemTitle(m_UGCUpdateHandle, "This is a Test");
            print("SteamUGC.SetItemTitle(" + m_UGCUpdateHandle + ", " + "\"This is a Test\"" + ") : " + ret);
        }

        if (GUILayout.Button("SetItemDescription(m_UGCUpdateHandle, \"This is the test description.\")"))
        {
            bool ret = SteamUGC.SetItemDescription(m_UGCUpdateHandle, "This is the test description.");
            print("SteamUGC.SetItemDescription(" + m_UGCUpdateHandle + ", " + "\"This is the test description.\"" + ") : " + ret);
        }

        if (GUILayout.Button("SetItemUpdateLanguage(m_UGCUpdateHandle, \"english\")"))
        {
            bool ret = SteamUGC.SetItemUpdateLanguage(m_UGCUpdateHandle, "english");
            print("SteamUGC.SetItemUpdateLanguage(" + m_UGCUpdateHandle + ", " + "\"english\"" + ") : " + ret);
        }

        if (GUILayout.Button("SetItemMetadata(m_UGCUpdateHandle, \"This is the test metadata.\")"))
        {
            bool ret = SteamUGC.SetItemMetadata(m_UGCUpdateHandle, "This is the test metadata.");
            print("SteamUGC.SetItemMetadata(" + m_UGCUpdateHandle + ", " + "\"This is the test metadata.\"" + ") : " + ret);
        }

        if (GUILayout.Button("SetItemVisibility(m_UGCUpdateHandle, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic)"))
        {
            bool ret = SteamUGC.SetItemVisibility(m_UGCUpdateHandle, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic);
            print("SteamUGC.SetItemVisibility(" + m_UGCUpdateHandle + ", " + ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic + ") : " + ret);
        }

        if (GUILayout.Button("SetItemTags(m_UGCUpdateHandle, new string[] {\"Tag One\", \"Tag Two\", \"Test Tags\", \"Sorry\"})"))
        {
            bool ret = SteamUGC.SetItemTags(m_UGCUpdateHandle, new string[] { "Tag One", "Tag Two", "Test Tags", "Sorry" });
            print("SteamUGC.SetItemTags(" + m_UGCUpdateHandle + ", " + new string[] { "Tag One", "Tag Two", "Test Tags", "Sorry" } +") : " + ret);
        }

        if (GUILayout.Button("SetItemContent(m_UGCUpdateHandle, Application.dataPath + \"/Scenes\")"))
        {
            bool ret = SteamUGC.SetItemContent(m_UGCUpdateHandle, Application.dataPath + "/Scenes");
            print("SteamUGC.SetItemContent(" + m_UGCUpdateHandle + ", " + Application.dataPath + "/Scenes" + ") : " + ret);
        }

        if (GUILayout.Button("SetItemPreview(m_UGCUpdateHandle, Application.dataPath + \"/PreviewImage.jpg\")"))
        {
            bool ret = SteamUGC.SetItemPreview(m_UGCUpdateHandle, Application.dataPath + "/PreviewImage.jpg");
            print("SteamUGC.SetItemPreview(" + m_UGCUpdateHandle + ", " + Application.dataPath + "/PreviewImage.jpg" + ") : " + ret);
        }

        if (GUILayout.Button("RemoveItemKeyValueTags(m_UGCUpdateHandle, \"TestKey\")"))
        {
            bool ret = SteamUGC.RemoveItemKeyValueTags(m_UGCUpdateHandle, "TestKey");
            print("SteamUGC.RemoveItemKeyValueTags(" + m_UGCUpdateHandle + ", " + "\"TestKey\"" + ") : " + ret);
        }

        if (GUILayout.Button("AddItemKeyValueTag(m_UGCUpdateHandle, \"TestKey\", \"TestValue\")"))
        {
            bool ret = SteamUGC.AddItemKeyValueTag(m_UGCUpdateHandle, "TestKey", "TestValue");
            print("SteamUGC.AddItemKeyValueTag(" + m_UGCUpdateHandle + ", " + "\"TestKey\"" + ", " + "\"TestValue\"" + ") : " + ret);
        }

        if (GUILayout.Button("AddItemPreviewFile(m_UGCUpdateHandle, Application.dataPath + \"/PreviewImage.jpg\", EItemPreviewType.k_EItemPreviewType_Image)"))
        {
            bool ret = SteamUGC.AddItemPreviewFile(m_UGCUpdateHandle, Application.dataPath + "/PreviewImage.jpg", EItemPreviewType.k_EItemPreviewType_Image);
            print("SteamUGC.AddItemPreviewFile(" + m_UGCUpdateHandle + ", " + Application.dataPath + "/PreviewImage.jpg" + ", " + EItemPreviewType.k_EItemPreviewType_Image + ") : " + ret);
        }

        if (GUILayout.Button("AddItemPreviewVideo(m_UGCUpdateHandle, \"jHgZh4GV9G0\")"))
        {
            bool ret = SteamUGC.AddItemPreviewVideo(m_UGCUpdateHandle, "jHgZh4GV9G0");
            print("SteamUGC.AddItemPreviewVideo(" + m_UGCUpdateHandle + ", " + "\"jHgZh4GV9G0\"" + ") : " + ret);
        }

        if (GUILayout.Button("UpdateItemPreviewFile(m_UGCUpdateHandle, 0, Application.dataPath + \"/PreviewImage.jpg\")"))
        {
            bool ret = SteamUGC.UpdateItemPreviewFile(m_UGCUpdateHandle, 0, Application.dataPath + "/PreviewImage.jpg");
            print("SteamUGC.UpdateItemPreviewFile(" + m_UGCUpdateHandle + ", " + 0 + ", " + Application.dataPath + "/PreviewImage.jpg" + ") : " + ret);
        }

        if (GUILayout.Button("UpdateItemPreviewVideo(m_UGCUpdateHandle, 0, \"jHgZh4GV9G0\")"))
        {
            bool ret = SteamUGC.UpdateItemPreviewVideo(m_UGCUpdateHandle, 0, "jHgZh4GV9G0");
            print("SteamUGC.UpdateItemPreviewVideo(" + m_UGCUpdateHandle + ", " + 0 + ", " + "\"jHgZh4GV9G0\"" + ") : " + ret);
        }

        if (GUILayout.Button("RemoveItemPreview(m_UGCUpdateHandle, 0)"))
        {
            bool ret = SteamUGC.RemoveItemPreview(m_UGCUpdateHandle, 0);
            print("SteamUGC.RemoveItemPreview(" + m_UGCUpdateHandle + ", " + 0 + ") : " + ret);
        }

        if (GUILayout.Button("SubmitItemUpdate(m_UGCUpdateHandle, \"Test Changenote\")"))
        {
            SteamAPICall_t handle = SteamUGC.SubmitItemUpdate(m_UGCUpdateHandle, "Test Changenote");
            OnSubmitItemUpdateResultCallResult.Set(handle);
            print("SteamUGC.SubmitItemUpdate(" + m_UGCUpdateHandle + ", " + "\"Test Changenote\"" + ") : " + handle);
        }

        {
            ulong             BytesProcessed;
            ulong             BytesTotal;
            EItemUpdateStatus ret = SteamUGC.GetItemUpdateProgress(m_UGCUpdateHandle, out BytesProcessed, out BytesTotal);
            GUILayout.Label("GetItemUpdateProgress(m_UGCUpdateHandle, out BytesProcessed, out BytesTotal) : " + ret + " -- " + BytesProcessed + " -- " + BytesTotal);
        }

        if (GUILayout.Button("SetUserItemVote(TestConstants.Instance.k_PublishedFileId_Champions, true)"))
        {
            SteamAPICall_t handle = SteamUGC.SetUserItemVote(TestConstants.Instance.k_PublishedFileId_Champions, true);
            OnSetUserItemVoteResultCallResult.Set(handle);
            print("SteamUGC.SetUserItemVote(" + TestConstants.Instance.k_PublishedFileId_Champions + ", " + true + ") : " + handle);
        }

        if (GUILayout.Button("GetUserItemVote(TestConstants.Instance.k_PublishedFileId_Champions)"))
        {
            SteamAPICall_t handle = SteamUGC.GetUserItemVote(TestConstants.Instance.k_PublishedFileId_Champions);
            OnGetUserItemVoteResultCallResult.Set(handle);
            print("SteamUGC.GetUserItemVote(" + TestConstants.Instance.k_PublishedFileId_Champions + ") : " + handle);
        }

        if (GUILayout.Button("AddItemToFavorites(SteamUtils.GetAppID(), TestConstants.Instance.k_PublishedFileId_Champions)"))
        {
            SteamAPICall_t handle = SteamUGC.AddItemToFavorites(SteamUtils.GetAppID(), TestConstants.Instance.k_PublishedFileId_Champions);
            OnUserFavoriteItemsListChangedCallResult.Set(handle);
            print("SteamUGC.AddItemToFavorites(" + SteamUtils.GetAppID() + ", " + TestConstants.Instance.k_PublishedFileId_Champions + ") : " + handle);
        }

        if (GUILayout.Button("RemoveItemFromFavorites(SteamUtils.GetAppID(), TestConstants.Instance.k_PublishedFileId_Champions)"))
        {
            SteamAPICall_t handle = SteamUGC.RemoveItemFromFavorites(SteamUtils.GetAppID(), TestConstants.Instance.k_PublishedFileId_Champions);
            OnUserFavoriteItemsListChangedCallResult.Set(handle);
            print("SteamUGC.RemoveItemFromFavorites(" + SteamUtils.GetAppID() + ", " + TestConstants.Instance.k_PublishedFileId_Champions + ") : " + handle);
        }

        if (GUILayout.Button("SubscribeItem(TestConstants.Instance.k_PublishedFileId_Champions)"))
        {
            SteamAPICall_t handle = SteamUGC.SubscribeItem(TestConstants.Instance.k_PublishedFileId_Champions);
            OnRemoteStorageSubscribePublishedFileResultCallResult.Set(handle);
            print("SteamUGC.SubscribeItem(" + TestConstants.Instance.k_PublishedFileId_Champions + ") : " + handle);
        }

        if (GUILayout.Button("UnsubscribeItem(TestConstants.Instance.k_PublishedFileId_Champions)"))
        {
            SteamAPICall_t handle = SteamUGC.UnsubscribeItem(TestConstants.Instance.k_PublishedFileId_Champions);
            OnRemoteStorageUnsubscribePublishedFileResultCallResult.Set(handle);
            print("SteamUGC.UnsubscribeItem(" + TestConstants.Instance.k_PublishedFileId_Champions + ") : " + handle);
        }

        GUILayout.Label("GetNumSubscribedItems() : " + SteamUGC.GetNumSubscribedItems());

        if (GUILayout.Button("GetSubscribedItems(PublishedFileID, (uint)PublishedFileID.Length)"))
        {
            PublishedFileId_t[] PublishedFileID = new PublishedFileId_t[1];
            uint ret = SteamUGC.GetSubscribedItems(PublishedFileID, (uint)PublishedFileID.Length);
            m_PublishedFileId = PublishedFileID[0];
            print("SteamUGC.GetSubscribedItems(" + PublishedFileID + ", " + (uint)PublishedFileID.Length + ") : " + ret);
            print(m_PublishedFileId);
        }

        GUILayout.Label("GetItemState(PublishedFileID) : " + (EItemState)SteamUGC.GetItemState(m_PublishedFileId));

        {
            ulong  SizeOnDisk;
            string Folder;
            uint   punTimeStamp;
            bool   ret = SteamUGC.GetItemInstallInfo(m_PublishedFileId, out SizeOnDisk, out Folder, 1024, out punTimeStamp);
            GUILayout.Label("GetItemInstallInfo(m_PublishedFileId, out SizeOnDisk, out Folder, 1024, out punTimeStamp) : " + ret + " -- " + SizeOnDisk + " -- " + Folder + " -- " + punTimeStamp);
        }

        if (GUILayout.Button("GetItemDownloadInfo(m_PublishedFileId, out BytesDownloaded, out BytesTotal)"))
        {
            ulong BytesDownloaded;
            ulong BytesTotal;
            bool  ret = SteamUGC.GetItemDownloadInfo(m_PublishedFileId, out BytesDownloaded, out BytesTotal);
            print("SteamUGC.GetItemDownloadInfo(" + m_PublishedFileId + ", " + "out BytesDownloaded" + ", " + "out BytesTotal" + ") : " + ret + " -- " + BytesDownloaded + " -- " + BytesTotal);
        }

        if (GUILayout.Button("DownloadItem(m_PublishedFileId, true)"))
        {
            bool ret = SteamUGC.DownloadItem(m_PublishedFileId, true);
            print("SteamUGC.DownloadItem(" + m_PublishedFileId + ", " + true + ") : " + ret);
        }

        if (GUILayout.Button("BInitWorkshopForGameServer((DepotId_t)481, \"C:/UGCTest\")"))
        {
            bool ret = SteamUGC.BInitWorkshopForGameServer((DepotId_t)481, "C:/UGCTest");
            print("SteamUGC.BInitWorkshopForGameServer(" + (DepotId_t)481 + ", " + "\"C:/UGCTest\"" + ") : " + ret);
        }

        if (GUILayout.Button("SuspendDownloads(true)"))
        {
            SteamUGC.SuspendDownloads(true);
            print("SteamUGC.SuspendDownloads(" + true + ")");
        }

        if (GUILayout.Button("StartPlaytimeTracking(PublishedFileIds, (uint)PublishedFileIds.Length)"))
        {
            PublishedFileId_t[] PublishedFileIds = new PublishedFileId_t[] { TestConstants.Instance.k_PublishedFileId_Champions };
            SteamAPICall_t      handle           = SteamUGC.StartPlaytimeTracking(PublishedFileIds, (uint)PublishedFileIds.Length);
            OnStartPlaytimeTrackingResultCallResult.Set(handle);
            print("SteamUGC.StartPlaytimeTracking(" + PublishedFileIds + ", " + (uint)PublishedFileIds.Length + ") : " + handle);
        }

        if (GUILayout.Button("StopPlaytimeTracking(PublishedFileIds, (uint)PublishedFileIds.Length)"))
        {
            PublishedFileId_t[] PublishedFileIds = new PublishedFileId_t[] { TestConstants.Instance.k_PublishedFileId_Champions };
            SteamAPICall_t      handle           = SteamUGC.StopPlaytimeTracking(PublishedFileIds, (uint)PublishedFileIds.Length);
            OnStopPlaytimeTrackingResultCallResult.Set(handle);
            print("SteamUGC.StopPlaytimeTracking(" + PublishedFileIds + ", " + (uint)PublishedFileIds.Length + ") : " + handle);
        }

        if (GUILayout.Button("StopPlaytimeTrackingForAllItems()"))
        {
            SteamAPICall_t handle = SteamUGC.StopPlaytimeTrackingForAllItems();
            OnStopPlaytimeTrackingResultCallResult.Set(handle);
            print("SteamUGC.StopPlaytimeTrackingForAllItems() : " + handle);
        }

        if (GUILayout.Button("AddDependency(m_PublishedFileId, TestConstants.Instance.k_PublishedFileId_Champions)"))
        {
            SteamAPICall_t handle = SteamUGC.AddDependency(m_PublishedFileId, TestConstants.Instance.k_PublishedFileId_Champions);
            OnAddUGCDependencyResultCallResult.Set(handle);
            print("SteamUGC.AddDependency(" + m_PublishedFileId + ", " + TestConstants.Instance.k_PublishedFileId_Champions + ") : " + handle);
        }

        if (GUILayout.Button("RemoveDependency(m_PublishedFileId, TestConstants.Instance.k_PublishedFileId_Champions)"))
        {
            SteamAPICall_t handle = SteamUGC.RemoveDependency(m_PublishedFileId, TestConstants.Instance.k_PublishedFileId_Champions);
            OnRemoveUGCDependencyResultCallResult.Set(handle);
            print("SteamUGC.RemoveDependency(" + m_PublishedFileId + ", " + TestConstants.Instance.k_PublishedFileId_Champions + ") : " + handle);
        }

        GUILayout.EndScrollView();
        GUILayout.EndVertical();
    }
		public static extern bool ISteamGameServerUtils_GetAPICallResult(SteamAPICall_t hSteamAPICall, IntPtr pCallback, int cubCallback, int iCallbackExpected, out bool pbFailed);
		// Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on
		// asynchronous response via callback.
		//
		// Note: If the user is in offline mode in Steam, then this will add a only-if-cached cache-control
		// header and only do a local cache lookup rather than sending any actual remote request.
		public static bool SendHTTPRequest(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle) {
			InteropHelp.TestIfAvailableClient();
			return NativeMethods.ISteamHTTP_SendHTTPRequest(hRequest, out pCallHandle);
		}
Beispiel #8
0
        // Token: 0x060017B2 RID: 6066 RVA: 0x00087EC8 File Offset: 0x000862C8
        public void updateUGC()
        {
            UGCUpdateHandle_t ugcupdateHandle_t = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), this.publishedFileID);

            if (this.ugcType == ESteamUGCType.MAP)
            {
                ReadWrite.writeBytes(this.ugcPath + "/Map.meta", false, false, new byte[1]);
            }
            else if (this.ugcType == ESteamUGCType.LOCALIZATION)
            {
                ReadWrite.writeBytes(this.ugcPath + "/Localization.meta", false, false, new byte[1]);
            }
            else if (this.ugcType == ESteamUGCType.OBJECT)
            {
                ReadWrite.writeBytes(this.ugcPath + "/Object.meta", false, false, new byte[1]);
            }
            else if (this.ugcType == ESteamUGCType.ITEM)
            {
                ReadWrite.writeBytes(this.ugcPath + "/Item.meta", false, false, new byte[1]);
            }
            else if (this.ugcType == ESteamUGCType.VEHICLE)
            {
                ReadWrite.writeBytes(this.ugcPath + "/Vehicle.meta", false, false, new byte[1]);
            }
            else if (this.ugcType == ESteamUGCType.SKIN)
            {
                ReadWrite.writeBytes(this.ugcPath + "/Skin.meta", false, false, new byte[1]);
            }
            SteamUGC.SetItemContent(ugcupdateHandle_t, this.ugcPath);
            if (this.ugcDescription.Length > 0)
            {
                SteamUGC.SetItemDescription(ugcupdateHandle_t, this.ugcDescription);
            }
            if (this.ugcPreview.Length > 0)
            {
                SteamUGC.SetItemPreview(ugcupdateHandle_t, this.ugcPreview);
            }
            List <string> list = new List <string>();

            if (this.ugcType == ESteamUGCType.MAP)
            {
                list.Add("Map");
            }
            else if (this.ugcType == ESteamUGCType.LOCALIZATION)
            {
                list.Add("Localization");
            }
            else if (this.ugcType == ESteamUGCType.OBJECT)
            {
                list.Add("Object");
            }
            else if (this.ugcType == ESteamUGCType.ITEM)
            {
                list.Add("Item");
            }
            else if (this.ugcType == ESteamUGCType.VEHICLE)
            {
                list.Add("Vehicle");
            }
            else if (this.ugcType == ESteamUGCType.SKIN)
            {
                list.Add("Skin");
            }
            if (this.ugcTag != null && this.ugcTag.Length > 0)
            {
                list.Add(this.ugcTag);
            }
            if (this.ugcVerified)
            {
                list.Add("Verified");
            }
            SteamUGC.SetItemTags(ugcupdateHandle_t, list.ToArray());
            if (this.ugcName.Length > 0)
            {
                SteamUGC.SetItemTitle(ugcupdateHandle_t, this.ugcName);
            }
            if (this.ugcVisibility == ESteamUGCVisibility.PUBLIC)
            {
                SteamUGC.SetItemVisibility(ugcupdateHandle_t, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic);
            }
            else if (this.ugcVisibility == ESteamUGCVisibility.FRIENDS_ONLY)
            {
                SteamUGC.SetItemVisibility(ugcupdateHandle_t, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityFriendsOnly);
            }
            else if (this.ugcVisibility == ESteamUGCVisibility.PRIVATE)
            {
                SteamUGC.SetItemVisibility(ugcupdateHandle_t, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate);
            }
            SteamAPICall_t hAPICall = SteamUGC.SubmitItemUpdate(ugcupdateHandle_t, this.ugcChange);

            this.submitItemUpdateResult.Set(hAPICall, null);
        }
Beispiel #9
0
    private void RenderPageTwo()
    {
        if (GUILayout.Button("SteamFriends.RequestUserInformation(m_Friend, false)"))
        {
            print("SteamFriends.RequestUserInformation(" + m_Friend + ", false) - " + SteamFriends.RequestUserInformation(m_Friend, false));
        }

        if (GUILayout.Button("SteamFriends.RequestClanOfficerList(m_Clan)"))
        {
            SteamAPICall_t handle = SteamFriends.RequestClanOfficerList(m_Clan);
            OnFriendRichPresenceCallResult.Set(handle);
            print("SteamFriends.RequestClanOfficerList(" + m_Clan + ") - " + handle);
        }

        GUILayout.Label("SteamFriends.GetClanOwner(m_Clan) : " + SteamFriends.GetClanOwner(m_Clan));
        GUILayout.Label("SteamFriends.GetClanOfficerCount(m_Clan) : " + SteamFriends.GetClanOfficerCount(m_Clan));
        GUILayout.Label("SteamFriends.GetClanOfficerByIndex(m_Clan, 0) : " + SteamFriends.GetClanOfficerByIndex(m_Clan, 0));
        GUILayout.Label("SteamFriends.GetUserRestrictions() : " + SteamFriends.GetUserRestrictions());

        if (GUILayout.Button("SteamFriends.SetRichPresence(\"status\", \"Testing 1.. 2.. 3..\")"))
        {
            print("SteamFriends.SetRichPresence(\"status\", \"Testing 1.. 2.. 3..\") - " + SteamFriends.SetRichPresence("status", "Testing 1.. 2.. 3.."));
        }

        if (GUILayout.Button("SteamFriends.ClearRichPresence()"))
        {
            SteamFriends.ClearRichPresence();
            print("SteamFriends.ClearRichPresence()");
        }

        GUILayout.Label("SteamFriends.GetFriendRichPresence(SteamUser.GetSteamID(), \"status\") : " + SteamFriends.GetFriendRichPresence(SteamUser.GetSteamID(), "status"));

        GUILayout.Label("SteamFriends.GetFriendRichPresenceKeyCount(SteamUser.GetSteamID()) : " + SteamFriends.GetFriendRichPresenceKeyCount(SteamUser.GetSteamID()));
        GUILayout.Label("SteamFriends.GetFriendRichPresenceKeyByIndex(SteamUser.GetSteamID(), 0) : " + SteamFriends.GetFriendRichPresenceKeyByIndex(SteamUser.GetSteamID(), 0));

        if (GUILayout.Button("SteamFriends.RequestFriendRichPresence(m_Friend)"))
        {
            SteamFriends.RequestFriendRichPresence(m_Friend);
            print("SteamFriends.RequestFriendRichPresence(" + m_Friend + ")");
        }

        if (GUILayout.Button("SteamFriends.InviteUserToGame(SteamUser.GetSteamID(), \"testing\")"))
        {
            print("SteamFriends.RequestFriendRichPresence(" + SteamUser.GetSteamID() + ", \"testing\") - " + SteamFriends.InviteUserToGame(SteamUser.GetSteamID(), "testing"));
        }

        GUILayout.Label("SteamFriends.GetCoplayFriendCount() : " + SteamFriends.GetCoplayFriendCount());
        if (SteamFriends.GetCoplayFriendCount() == 0)
        {
            Debug.LogError("You must have atleast one clan to use this Test");
            return;
        }

        m_CoPlayFriend = SteamFriends.GetCoplayFriend(0);
        GUILayout.Label("SteamFriends.GetCoplayFriend(0) : " + m_CoPlayFriend);
        GUILayout.Label("SteamFriends.GetFriendCoplayTime(m_CoPlayFriend) : " + SteamFriends.GetFriendCoplayTime(m_CoPlayFriend));
        GUILayout.Label("SteamFriends.GetFriendCoplayGame(m_CoPlayFriend) : " + SteamFriends.GetFriendCoplayGame(m_CoPlayFriend));

        if (GUILayout.Button("SteamFriends.JoinClanChatRoom(m_Clan)"))
        {
            SteamAPICall_t handle = SteamFriends.JoinClanChatRoom(m_Clan);
            OnJoinClanChatRoomCompletionResultCallResult.Set(handle);
            print("SteamFriends.JoinClanChatRoom(m_Clan) - " + handle);
        }

        if (GUILayout.Button("SteamFriends.LeaveClanChatRoom(m_Clan)"))
        {
            print("SteamFriends.LeaveClanChatRoom(m_Clan) - " + SteamFriends.LeaveClanChatRoom(m_Clan));
        }

        GUILayout.Label("SteamFriends.GetClanChatMemberCount(m_Clan) : " + SteamFriends.GetClanChatMemberCount(m_Clan));
        GUILayout.Label("SteamFriends.GetChatMemberByIndex(m_Clan, 0) : " + SteamFriends.GetChatMemberByIndex(m_Clan, 0));

        if (GUILayout.Button("SteamFriends.SendClanChatMessage(m_Clan, \"Test\")"))
        {
            print("SteamFriends.SendClanChatMessage(m_Clan, \"Test\") - " + SteamFriends.SendClanChatMessage(m_Clan, "Test"));
        }

        //GUILayout.Label("SteamFriends.GetClanChatMessage() : " + SteamFriends.GetClanChatMessage()); // N/A - Must be called from within the callback OnGameConnectedClanChatMsg

        GUILayout.Label("SteamFriends.IsClanChatAdmin(m_Clan, SteamFriends.GetChatMemberByIndex(m_Clan, 0)) : " + SteamFriends.IsClanChatAdmin(m_Clan, SteamFriends.GetChatMemberByIndex(m_Clan, 0)));
        GUILayout.Label("SteamFriends.IsClanChatWindowOpenInSteam(m_Clan) - " + SteamFriends.IsClanChatWindowOpenInSteam(m_Clan));

        if (GUILayout.Button("SteamFriends.OpenClanChatWindowInSteam(m_Clan)"))
        {
            print("SteamFriends.OpenClanChatWindowInSteam(" + m_Clan + ") - " + SteamFriends.OpenClanChatWindowInSteam(m_Clan));
        }

        if (GUILayout.Button("SteamFriends.CloseClanChatWindowInSteam(m_Clan)"))
        {
            print("SteamFriends.CloseClanChatWindowInSteam(" + m_Clan + ") - " + SteamFriends.CloseClanChatWindowInSteam(m_Clan));
        }

        if (GUILayout.Button("SteamFriends.SetListenForFriendsMessages(true)"))
        {
            print("SteamFriends.SetListenForFriendsMessages(true) - " + SteamFriends.SetListenForFriendsMessages(true));
        }

        if (GUILayout.Button("SteamFriends.ReplyToFriendMessage(SteamUser.GetSteamID(), \"Testing!\")"))
        {
            print("SteamFriends.ReplyToFriendMessage(" + SteamUser.GetSteamID() + ", \"Testing!\") - " + SteamFriends.ReplyToFriendMessage(SteamUser.GetSteamID(), "Testing!"));
        }

        //GUILayout.Label("SteamFriends.GetFriendMessage() : " + SteamFriends.GetFriendMessage()); // N/A - Must be called from within the callback OnGameConnectedFriendChatMsg

        if (GUILayout.Button("SteamFriends.GetFollowerCount(SteamUser.GetSteamID())"))
        {
            SteamAPICall_t handle = SteamFriends.GetFollowerCount(SteamUser.GetSteamID());
            OnFriendsGetFollowerCountCallResult.Set(handle);
            print("SteamFriends.GetFollowerCount(" + SteamUser.GetSteamID() + ") - " + handle);
        }

        if (GUILayout.Button("SteamFriends.IsFollowing(m_Friend)"))
        {
            SteamAPICall_t handle = SteamFriends.IsFollowing(m_Friend);
            OnFriendsIsFollowingCallResult.Set(handle);
            print("SteamFriends.IsFollowing(m_Friend) - " + handle);
        }

        if (GUILayout.Button("SteamFriends.EnumerateFollowingList(0)"))
        {
            SteamAPICall_t handle = SteamFriends.EnumerateFollowingList(0);
            OnFriendsEnumerateFollowingListCallResult.Set(handle);
            print("SteamFriends.EnumerateFollowingList(0) - " + handle);
        }
    }
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_Friend: " + m_Friend);
        GUILayout.Label("m_Clan: " + m_Clan);
        GUILayout.Label("m_CoPlayFriend: " + m_CoPlayFriend);
        GUILayout.Label("m_SmallAvatar:");
        GUILayout.Label(m_SmallAvatar);
        GUILayout.Label("m_MediumAvatar:");
        GUILayout.Label(m_MediumAvatar);
        GUILayout.Label("m_LargeAvatar:");
        GUILayout.Label(m_LargeAvatar);
        GUILayout.EndArea();

        GUILayout.BeginVertical("box");
        m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33));

        GUILayout.Label("GetPersonaName() : " + SteamFriends.GetPersonaName());

        if (GUILayout.Button("SetPersonaName(SteamFriends.GetPersonaName())"))
        {
            SteamAPICall_t handle = SteamFriends.SetPersonaName(SteamFriends.GetPersonaName());
            OnSetPersonaNameResponseCallResult.Set(handle);
            print("SteamFriends.SetPersonaName(" + SteamFriends.GetPersonaName() + ") : " + handle);
        }

        GUILayout.Label("GetPersonaState() : " + SteamFriends.GetPersonaState());

        GUILayout.Label("GetFriendCount(EFriendFlags.k_EFriendFlagImmediate) : " + SteamFriends.GetFriendCount(EFriendFlags.k_EFriendFlagImmediate));

        {
            m_Friend = SteamFriends.GetFriendByIndex(0, EFriendFlags.k_EFriendFlagImmediate);
            GUILayout.Label("GetFriendByIndex(0, EFriendFlags.k_EFriendFlagImmediate) : " + m_Friend);
        }

        GUILayout.Label("GetFriendRelationship(m_Friend) : " + SteamFriends.GetFriendRelationship(m_Friend));

        GUILayout.Label("GetFriendPersonaState(m_Friend) : " + SteamFriends.GetFriendPersonaState(m_Friend));

        GUILayout.Label("GetFriendPersonaName(m_Friend) : " + SteamFriends.GetFriendPersonaName(m_Friend));

        {
            var  fgi = new FriendGameInfo_t();
            bool ret = SteamFriends.GetFriendGamePlayed(m_Friend, out fgi);
            GUILayout.Label("GetFriendGamePlayed(m_Friend, out fgi) : " + ret + " -- " + fgi.m_gameID + " -- " + fgi.m_unGameIP + " -- " + fgi.m_usGamePort + " -- " + fgi.m_usQueryPort + " -- " + fgi.m_steamIDLobby);
        }

        GUILayout.Label("GetFriendPersonaNameHistory(m_Friend, 1) : " + SteamFriends.GetFriendPersonaNameHistory(m_Friend, 1));

        GUILayout.Label("GetFriendSteamLevel(m_Friend) : " + SteamFriends.GetFriendSteamLevel(m_Friend));

        GUILayout.Label("GetPlayerNickname(m_Friend) : " + SteamFriends.GetPlayerNickname(m_Friend));

        {
            int FriendsGroupCount = SteamFriends.GetFriendsGroupCount();
            GUILayout.Label("GetFriendsGroupCount() : " + FriendsGroupCount);

            if (FriendsGroupCount > 0)
            {
                FriendsGroupID_t FriendsGroupID = SteamFriends.GetFriendsGroupIDByIndex(0);
                GUILayout.Label("SteamFriends.GetFriendsGroupIDByIndex(0) : " + FriendsGroupID);

                GUILayout.Label("GetFriendsGroupName(FriendsGroupID) : " + SteamFriends.GetFriendsGroupName(FriendsGroupID));

                int FriendsGroupMembersCount = SteamFriends.GetFriendsGroupMembersCount(FriendsGroupID);
                GUILayout.Label("GetFriendsGroupMembersCount(FriendsGroupID) : " + FriendsGroupMembersCount);

                if (FriendsGroupMembersCount > 0)
                {
                    CSteamID[] FriendsGroupMembersList = new CSteamID[FriendsGroupMembersCount];
                    SteamFriends.GetFriendsGroupMembersList(FriendsGroupID, FriendsGroupMembersList, FriendsGroupMembersCount);
                    GUILayout.Label("GetFriendsGroupMembersList(FriendsGroupID, FriendsGroupMembersList, FriendsGroupMembersCount) : " + FriendsGroupMembersList[0]);
                }
            }
        }

        GUILayout.Label("HasFriend(m_Friend, EFriendFlags.k_EFriendFlagImmediate) : " + SteamFriends.HasFriend(m_Friend, EFriendFlags.k_EFriendFlagImmediate));

        GUILayout.Label("GetClanCount() : " + SteamFriends.GetClanCount());

        m_Clan = SteamFriends.GetClanByIndex(0);
        GUILayout.Label("GetClanByIndex(0) : " + m_Clan);

        GUILayout.Label("GetClanName(m_Clan) : " + SteamFriends.GetClanName(m_Clan));

        GUILayout.Label("GetClanTag(m_Clan) : " + SteamFriends.GetClanTag(m_Clan));

        {
            int  Online;
            int  InGame;
            int  Chatting;
            bool ret = SteamFriends.GetClanActivityCounts(m_Clan, out Online, out InGame, out Chatting);
            GUILayout.Label("GetClanActivityCounts(m_Clan, out Online, out InGame, out Chatting) : " + ret + " -- " + Online + " -- " + InGame + " -- " + Chatting);
        }

        if (GUILayout.Button("DownloadClanActivityCounts(Clans, Clans.Length)"))
        {
            CSteamID[]     Clans  = { m_Clan, TestConstants.Instance.k_SteamId_Group_SteamUniverse };
            SteamAPICall_t handle = SteamFriends.DownloadClanActivityCounts(Clans, Clans.Length);
            OnDownloadClanActivityCountsResultCallResult.Set(handle);             // This call never seems to produce the CallResult.
            print("SteamFriends.DownloadClanActivityCounts(" + Clans + ", " + Clans.Length + ") : " + handle);
        }

        {
            int FriendCount = SteamFriends.GetFriendCountFromSource(m_Clan);
            GUILayout.Label("GetFriendCountFromSource(m_Clan) : " + FriendCount);

            if (FriendCount > 0)
            {
                GUILayout.Label("GetFriendFromSourceByIndex(m_Clan, 0) : " + SteamFriends.GetFriendFromSourceByIndex(m_Clan, 0));
            }
        }

        GUILayout.Label("IsUserInSource(m_Friend, m_Clan) : " + SteamFriends.IsUserInSource(m_Friend, m_Clan));

        if (GUILayout.Button("SetInGameVoiceSpeaking(SteamUser.GetSteamID(), false)"))
        {
            SteamFriends.SetInGameVoiceSpeaking(SteamUser.GetSteamID(), false);
            print("SteamFriends.SetInGameVoiceSpeaking(" + SteamUser.GetSteamID() + ", " + false + ")");
        }

        if (GUILayout.Button("ActivateGameOverlay(\"Friends\")"))
        {
            SteamFriends.ActivateGameOverlay("Friends");
            print("SteamFriends.ActivateGameOverlay(" + "\"Friends\"" + ")");
        }

        if (GUILayout.Button("ActivateGameOverlayToUser(\"friendadd\", TestConstants.Instance.k_SteamId_rlabrecque)"))
        {
            SteamFriends.ActivateGameOverlayToUser("friendadd", TestConstants.Instance.k_SteamId_rlabrecque);
            print("SteamFriends.ActivateGameOverlayToUser(" + "\"friendadd\"" + ", " + TestConstants.Instance.k_SteamId_rlabrecque + ")");
        }

        if (GUILayout.Button("ActivateGameOverlayToWebPage(\"http://steamworks.github.io\")"))
        {
            SteamFriends.ActivateGameOverlayToWebPage("http://steamworks.github.io");
            print("SteamFriends.ActivateGameOverlayToWebPage(" + "\"http://steamworks.github.io\"" + ")");
        }

        if (GUILayout.Button("ActivateGameOverlayToStore(TestConstants.Instance.k_AppId_TeamFortress2, EOverlayToStoreFlag.k_EOverlayToStoreFlag_None)"))
        {
            SteamFriends.ActivateGameOverlayToStore(TestConstants.Instance.k_AppId_TeamFortress2, EOverlayToStoreFlag.k_EOverlayToStoreFlag_None);
            print("SteamFriends.ActivateGameOverlayToStore(" + TestConstants.Instance.k_AppId_TeamFortress2 + ", " + EOverlayToStoreFlag.k_EOverlayToStoreFlag_None + ")");
        }

        if (GUILayout.Button("SetPlayedWith(TestConstants.Instance.k_SteamId_rlabrecque)"))
        {
            SteamFriends.SetPlayedWith(TestConstants.Instance.k_SteamId_rlabrecque);
            print("SteamFriends.SetPlayedWith(" + TestConstants.Instance.k_SteamId_rlabrecque + ")");
        }

        if (GUILayout.Button("ActivateGameOverlayInviteDialog(TestConstants.Instance.k_SteamId_rlabrecque)"))
        {
            SteamFriends.ActivateGameOverlayInviteDialog(TestConstants.Instance.k_SteamId_rlabrecque);
            print("SteamFriends.ActivateGameOverlayInviteDialog(" + TestConstants.Instance.k_SteamId_rlabrecque + ")");
        }

        if (GUILayout.Button("GetSmallFriendAvatar(m_Friend)"))
        {
            int ret = SteamFriends.GetSmallFriendAvatar(m_Friend);
            print("SteamFriends.GetSmallFriendAvatar(" + m_Friend + ") : " + ret);
            m_SmallAvatar = SteamUtilsTest.GetSteamImageAsTexture2D(ret);
        }

        if (GUILayout.Button("GetMediumFriendAvatar(m_Friend)"))
        {
            int ret = SteamFriends.GetMediumFriendAvatar(m_Friend);
            print("SteamFriends.GetMediumFriendAvatar(" + m_Friend + ") : " + ret);
            m_MediumAvatar = SteamUtilsTest.GetSteamImageAsTexture2D(ret);
        }

        if (GUILayout.Button("GetLargeFriendAvatar(m_Friend)"))
        {
            int ret = SteamFriends.GetLargeFriendAvatar(m_Friend);
            print("SteamFriends.GetLargeFriendAvatar(" + m_Friend + ") : " + ret);
            m_LargeAvatar = SteamUtilsTest.GetSteamImageAsTexture2D(ret);
        }

        if (GUILayout.Button("RequestUserInformation(m_Friend, false)"))
        {
            bool ret = SteamFriends.RequestUserInformation(m_Friend, false);
            print("SteamFriends.RequestUserInformation(" + m_Friend + ", " + false + ") : " + ret);
        }

        if (GUILayout.Button("RequestClanOfficerList(m_Clan)"))
        {
            SteamAPICall_t handle = SteamFriends.RequestClanOfficerList(m_Clan);
            OnClanOfficerListResponseCallResult.Set(handle);
            print("SteamFriends.RequestClanOfficerList(" + m_Clan + ") : " + handle);
        }

        GUILayout.Label("GetClanOwner(m_Clan) : " + SteamFriends.GetClanOwner(m_Clan));

        GUILayout.Label("GetClanOfficerCount(m_Clan) : " + SteamFriends.GetClanOfficerCount(m_Clan));

        GUILayout.Label("GetClanOfficerByIndex(m_Clan, 0) : " + SteamFriends.GetClanOfficerByIndex(m_Clan, 0));

        GUILayout.Label("GetUserRestrictions() : " + SteamFriends.GetUserRestrictions());

        if (GUILayout.Button("SetRichPresence(\"status\", \"Testing 1.. 2.. 3..\")"))
        {
            bool ret = SteamFriends.SetRichPresence("status", "Testing 1.. 2.. 3..");
            print("SteamFriends.SetRichPresence(" + "\"status\"" + ", " + "\"Testing 1.. 2.. 3..\"" + ") : " + ret);
        }

        if (GUILayout.Button("ClearRichPresence()"))
        {
            SteamFriends.ClearRichPresence();
            print("SteamFriends.ClearRichPresence()");
        }

        GUILayout.Label("GetFriendRichPresence(SteamUser.GetSteamID(), \"status\") : " + SteamFriends.GetFriendRichPresence(SteamUser.GetSteamID(), "status"));

        GUILayout.Label("GetFriendRichPresenceKeyCount(SteamUser.GetSteamID()) : " + SteamFriends.GetFriendRichPresenceKeyCount(SteamUser.GetSteamID()));

        GUILayout.Label("GetFriendRichPresenceKeyByIndex(SteamUser.GetSteamID(), 0) : " + SteamFriends.GetFriendRichPresenceKeyByIndex(SteamUser.GetSteamID(), 0));

        if (GUILayout.Button("RequestFriendRichPresence(m_Friend)"))
        {
            SteamFriends.RequestFriendRichPresence(m_Friend);
            print("SteamFriends.RequestFriendRichPresence(" + m_Friend + ")");
        }

        if (GUILayout.Button("InviteUserToGame(SteamUser.GetSteamID(), \"testing\")"))
        {
            bool ret = SteamFriends.InviteUserToGame(SteamUser.GetSteamID(), "testing");
            print("SteamFriends.InviteUserToGame(" + SteamUser.GetSteamID() + ", " + "\"testing\"" + ") : " + ret);
        }

        GUILayout.Label("GetCoplayFriendCount() : " + SteamFriends.GetCoplayFriendCount());

        if (GUILayout.Button("GetCoplayFriend(0)"))
        {
            m_CoPlayFriend = SteamFriends.GetCoplayFriend(0);
            print("SteamFriends.GetCoplayFriend(" + 0 + ") : " + m_CoPlayFriend);
        }

        GUILayout.Label("GetFriendCoplayTime(m_CoPlayFriend) : " + SteamFriends.GetFriendCoplayTime(m_CoPlayFriend));

        GUILayout.Label("GetFriendCoplayGame(m_CoPlayFriend) : " + SteamFriends.GetFriendCoplayGame(m_CoPlayFriend));

        if (GUILayout.Button("JoinClanChatRoom(m_Clan)"))
        {
            SteamAPICall_t handle = SteamFriends.JoinClanChatRoom(m_Clan);
            OnJoinClanChatRoomCompletionResultCallResult.Set(handle);
            print("SteamFriends.JoinClanChatRoom(" + m_Clan + ") : " + handle);
        }

        if (GUILayout.Button("LeaveClanChatRoom(m_Clan)"))
        {
            bool ret = SteamFriends.LeaveClanChatRoom(m_Clan);
            print("SteamFriends.LeaveClanChatRoom(" + m_Clan + ") : " + ret);
        }

        GUILayout.Label("GetClanChatMemberCount(m_Clan) : " + SteamFriends.GetClanChatMemberCount(m_Clan));

        GUILayout.Label("GetChatMemberByIndex(m_Clan, 0) : " + SteamFriends.GetChatMemberByIndex(m_Clan, 0));

        if (GUILayout.Button("SendClanChatMessage(m_Clan, \"Test\")"))
        {
            bool ret = SteamFriends.SendClanChatMessage(m_Clan, "Test");
            print("SteamFriends.SendClanChatMessage(" + m_Clan + ", " + "\"Test\"" + ") : " + ret);
        }

        //GUILayout.Label("SteamFriends.GetClanChatMessage() : " + SteamFriends.GetClanChatMessage()); // N/A - Must be called from within the callback OnGameConnectedClanChatMsg

        GUILayout.Label("IsClanChatAdmin(m_Clan, m_Friend) : " + SteamFriends.IsClanChatAdmin(m_Clan, m_Friend));

        GUILayout.Label("IsClanChatWindowOpenInSteam(m_Clan) : " + SteamFriends.IsClanChatWindowOpenInSteam(m_Clan));

        if (GUILayout.Button("OpenClanChatWindowInSteam(m_Clan)"))
        {
            bool ret = SteamFriends.OpenClanChatWindowInSteam(m_Clan);
            print("SteamFriends.OpenClanChatWindowInSteam(" + m_Clan + ") : " + ret);
        }

        if (GUILayout.Button("CloseClanChatWindowInSteam(m_Clan)"))
        {
            bool ret = SteamFriends.CloseClanChatWindowInSteam(m_Clan);
            print("SteamFriends.CloseClanChatWindowInSteam(" + m_Clan + ") : " + ret);
        }

        if (GUILayout.Button("SetListenForFriendsMessages(true)"))
        {
            bool ret = SteamFriends.SetListenForFriendsMessages(true);
            print("SteamFriends.SetListenForFriendsMessages(" + true + ") : " + ret);
        }

        if (GUILayout.Button("ReplyToFriendMessage(SteamUser.GetSteamID(), \"Testing!\")"))
        {
            bool ret = SteamFriends.ReplyToFriendMessage(SteamUser.GetSteamID(), "Testing!");
            print("SteamFriends.ReplyToFriendMessage(" + SteamUser.GetSteamID() + ", " + "\"Testing!\"" + ") : " + ret);
        }

        //GUILayout.Label("SteamFriends.GetFriendMessage() : " + SteamFriends.GetFriendMessage()); // N/A - Must be called from within the callback OnGameConnectedFriendChatMsg

        if (GUILayout.Button("GetFollowerCount(SteamUser.GetSteamID())"))
        {
            SteamAPICall_t handle = SteamFriends.GetFollowerCount(SteamUser.GetSteamID());
            OnFriendsGetFollowerCountCallResult.Set(handle);
            print("SteamFriends.GetFollowerCount(" + SteamUser.GetSteamID() + ") : " + handle);
        }

        if (GUILayout.Button("IsFollowing(m_Friend)"))
        {
            SteamAPICall_t handle = SteamFriends.IsFollowing(m_Friend);
            OnFriendsIsFollowingCallResult.Set(handle);
            print("SteamFriends.IsFollowing(" + m_Friend + ") : " + handle);
        }

        if (GUILayout.Button("EnumerateFollowingList(0)"))
        {
            SteamAPICall_t handle = SteamFriends.EnumerateFollowingList(0);
            OnFriendsEnumerateFollowingListCallResult.Set(handle);
            print("SteamFriends.EnumerateFollowingList(" + 0 + ") : " + handle);
        }

        GUILayout.Label("IsClanPublic(m_Clan) : " + SteamFriends.IsClanPublic(m_Clan));

        GUILayout.Label("IsClanOfficialGameGroup(m_Clan) : " + SteamFriends.IsClanOfficialGameGroup(m_Clan));

        GUILayout.Label("GetNumChatsWithUnreadPriorityMessages() : " + SteamFriends.GetNumChatsWithUnreadPriorityMessages());

        GUILayout.EndScrollView();
        GUILayout.EndVertical();
    }
Beispiel #11
0
        // Token: 0x060017B1 RID: 6065 RVA: 0x00087E94 File Offset: 0x00086294
        public void createUGC(bool ugcFor)
        {
            SteamAPICall_t hAPICall = SteamUGC.CreateItem(SteamUtils.GetAppID(), (!ugcFor) ? EWorkshopFileType.k_EWorkshopFileTypeFirst : EWorkshopFileType.k_EWorkshopFileTypeMicrotransaction);

            this.createItemResult.Set(hAPICall, null);
        }
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_Ticket: " + m_Ticket);
        GUILayout.Label("m_pcbTicket: " + m_pcbTicket);
        GUILayout.Label("m_HAuthTicket: " + m_HAuthTicket);
        GUILayout.Label("m_VoiceLoopback: " + m_VoiceLoopback);
        GUILayout.EndArea();

        GUILayout.BeginVertical("box");
        m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33));

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

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

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

        //SteamUser.InitiateGameConnection() // N/A - Too Hard to test like this.

        //SteamUser.TerminateGameConnection() // ^

        //SteamUser.TrackAppUsageEvent() // Legacy function with no documentation

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

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

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

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

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

                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);
                        }
                        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("GetVoiceOptimalSampleRate() : " + SteamUser.GetVoiceOptimalSampleRate());

        {
            if (GUILayout.Button("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("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("EndAuthSession(SteamUser.GetSteamID())"))
        {
            SteamUser.EndAuthSession(SteamUser.GetSteamID());
            print("SteamUser.EndAuthSession(" + SteamUser.GetSteamID() + ")");
        }

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

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

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

        if (GUILayout.Button("AdvertiseGame(CSteamID.NonSteamGS, TestConstants.k_IpAddress127_0_0_1_uint, TestConstants.k_Port27015)"))
        {
            SteamUser.AdvertiseGame(CSteamID.NonSteamGS, TestConstants.k_IpAddress127_0_0_1_uint, TestConstants.k_Port27015);
            print("SteamUser.AdvertiseGame(" + CSteamID.NonSteamGS + ", " + TestConstants.k_IpAddress127_0_0_1_uint + ", " + TestConstants.k_Port27015 + ")");
        }

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

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

        // SpaceWar does not have trading cards, so this function will only ever return 0 and produce an annoying warning.
        if (GUILayout.Button("GetGameBadgeLevel(1, false)"))
        {
            int ret = SteamUser.GetGameBadgeLevel(1, false);
            print("SteamUser.GetGameBadgeLevel(" + 1 + ", " + false + ") : " + ret);
        }

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

        if (GUILayout.Button("RequestStoreAuthURL(\"https://steampowered.com\")"))
        {
            SteamAPICall_t handle = SteamUser.RequestStoreAuthURL("https://steampowered.com");
            OnStoreAuthURLResponseCallResult.Set(handle);
            print("SteamUser.RequestStoreAuthURL(" + "\"https://steampowered.com\"" + ") : " + handle);
        }

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

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

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

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

        if (GUILayout.Button("GetMarketEligibility()"))
        {
            SteamAPICall_t handle = SteamUser.GetMarketEligibility();
            OnMarketEligibilityResponseCallResult.Set(handle);
            print("SteamUser.GetMarketEligibility() : " + handle);
        }

        if (GUILayout.Button("GetDurationControl()"))
        {
            SteamAPICall_t handle = SteamUser.GetDurationControl();
            OnDurationControlCallResult.Set(handle);
            print("SteamUser.GetDurationControl() : " + handle);
        }

        GUILayout.EndScrollView();
        GUILayout.EndVertical();
    }
Beispiel #13
0
 public static bool SendHTTPRequest(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamHTTP_SendHTTPRequest(CSteamGameServerAPIContext.GetSteamHTTP(), hRequest, out pCallHandle));
 }
Beispiel #14
0
 public void UploadScore(LeaderboardHandle Handle, int Value)
 {
     SteamAPICall_t hSteamAPICall = (SteamAPICall_t)SteamUserStats.UploadLeaderboardScore(Handle.m_handle, ELeaderboardUploadScoreMethod.k_ELeaderboardUploadScoreMethodKeepBest, Value, null, 0);
 }
Beispiel #15
0
		public static extern bool ISteamRemoteStorage_FileReadAsyncComplete(SteamAPICall_t hReadCall, [In, Out] byte[] pvBuffer, uint cubToRead);
Beispiel #16
0
    private void RenderPageOne()
    {
        GUILayout.Label("SteamFriends.GetPersonaName() : " + SteamFriends.GetPersonaName());

        if (GUILayout.Button("SteamFriends.SetPersonaName(SteamFriends.GetPersonaName())"))
        {
            SteamAPICall_t handle = SteamFriends.SetPersonaName(SteamFriends.GetPersonaName());
            OnSetPersonaNameResponseCallResult.Set(handle);
            print("SteamFriends.SetPersonaName(" + SteamFriends.GetPersonaName() + ") : " + handle);
        }

        GUILayout.Label("SteamFriends.GetPersonaState() : " + SteamFriends.GetPersonaState());
        GUILayout.Label("SteamFriends.GetFriendCount(k_EFriendFlagImmediate) : " + SteamFriends.GetFriendCount(EFriendFlags.k_EFriendFlagImmediate));
        if (SteamFriends.GetFriendCount(EFriendFlags.k_EFriendFlagImmediate) == 0)
        {
            Debug.LogError("You must have atleast one friend to use this Test");
            return;
        }

        m_Friend = SteamFriends.GetFriendByIndex(0, EFriendFlags.k_EFriendFlagImmediate);
        GUILayout.Label("SteamFriends.GetFriendByIndex(0, k_EFriendFlagImmediate) : " + m_Friend);
        GUILayout.Label("SteamFriends.GetFriendRelationship(m_Friend) : " + SteamFriends.GetFriendRelationship(m_Friend));
        GUILayout.Label("SteamFriends.GetFriendPersonaState(m_Friend) : " + SteamFriends.GetFriendPersonaState(m_Friend));
        GUILayout.Label("SteamFriends.GetFriendPersonaName(m_Friend) : " + SteamFriends.GetFriendPersonaName(m_Friend));

        {
            var  fgi = new FriendGameInfo_t();
            bool ret = SteamFriends.GetFriendGamePlayed(m_Friend, out fgi);
            GUILayout.Label("SteamFriends.GetFriendGamePlayed(m_Friend, out fgi) : " + ret + " -- " + fgi.m_gameID + " -- " + fgi.m_unGameIP + " -- " + fgi.m_usGamePort + " -- " + fgi.m_usQueryPort + " -- " + fgi.m_steamIDLobby);
        }

        GUILayout.Label("SteamFriends.GetFriendPersonaNameHistory(m_Friend, 1) : " + SteamFriends.GetFriendPersonaNameHistory(m_Friend, 1));
        GUILayout.Label("SteamFriends.GetPlayerNickname(m_Friend) : " + SteamFriends.GetPlayerNickname(m_Friend));
        GUILayout.Label("SteamFriends.HasFriend(m_Friend, k_EFriendFlagImmediate) : " + SteamFriends.HasFriend(m_Friend, EFriendFlags.k_EFriendFlagImmediate));

        GUILayout.Label("SteamFriends.GetClanCount() : " + SteamFriends.GetClanCount());
        if (SteamFriends.GetClanCount() == 0)
        {
            Debug.LogError("You must have atleast one clan to use this Test");
            return;
        }

        m_Clan = SteamFriends.GetClanByIndex(0);
        GUILayout.Label("SteamFriends.GetClanByIndex(0) : " + m_Clan);
        GUILayout.Label("SteamFriends.GetClanName(m_Clan) : " + SteamFriends.GetClanName(m_Clan));
        GUILayout.Label("SteamFriends.GetClanTag(m_Clan) : " + SteamFriends.GetClanTag(m_Clan));

        {
            int  Online;
            int  InGame;
            int  Chatting;
            bool ret = SteamFriends.GetClanActivityCounts(m_Clan, out Online, out InGame, out Chatting);
            GUILayout.Label("SteamFriends.GetClanActivityCounts(m_Clan, out Online, out InGame, out Chatting) : " + ret + " -- " + Online + " -- " + InGame + " -- " + Chatting);
        }

        if (GUILayout.Button("SteamFriends.DownloadClanActivityCounts(m_Clans, 2)"))
        {
            CSteamID[]     Clans  = { m_Clan, new CSteamID(103582791434672565) }; // m_Clan, Steam Universe
            SteamAPICall_t handle = SteamFriends.DownloadClanActivityCounts(Clans, 2);
            OnDownloadClanActivityCountsResultCallResult.Set(handle);             // This call never seems to produce a callback.
            print("SteamFriends.DownloadClanActivityCounts(" + Clans + ", 2) : " + handle);
        }

        {
            int FriendCount = SteamFriends.GetFriendCountFromSource(m_Clan);
            GUILayout.Label("SteamFriends.GetFriendCountFromSource(m_Clan) : " + FriendCount);

            if (FriendCount > 0)
            {
                GUILayout.Label("SteamFriends.GetFriendFromSourceByIndex(m_Clan, 0) : " + SteamFriends.GetFriendFromSourceByIndex(m_Clan, 0));
            }
        }

        GUILayout.Label("SteamFriends.IsUserInSource(m_Friend, m_Clan) : " + SteamFriends.IsUserInSource(m_Friend, m_Clan));

        if (GUILayout.Button("SteamFriends.SetInGameVoiceSpeaking(SteamUser.GetSteamID(), false)"))
        {
            SteamFriends.SetInGameVoiceSpeaking(SteamUser.GetSteamID(), false);
            print("SteamClient.SetInGameVoiceSpeaking(" + SteamUser.GetSteamID() + ", false);");
        }

        if (GUILayout.Button("SteamFriends.ActivateGameOverlay(\"Friends\")"))
        {
            SteamFriends.ActivateGameOverlay("Friends");
            print("SteamClient.ActivateGameOverlay(\"Friends\")");
        }

        if (GUILayout.Button("SteamFriends.ActivateGameOverlayToUser(\"friendadd\", 76561197991230424)"))
        {
            SteamFriends.ActivateGameOverlayToUser("friendadd", new CSteamID(76561197991230424));             // rlabrecque
            print("SteamClient.ActivateGameOverlay(\"friendadd\", 76561197991230424)");
        }

        if (GUILayout.Button("SteamFriends.ActivateGameOverlayToWebPage(\"http://google.com\")"))
        {
            SteamFriends.ActivateGameOverlayToWebPage("http://google.com");
            print("SteamClient.ActivateGameOverlay(\"http://google.com\")");
        }

        if (GUILayout.Button("SteamFriends.ActivateGameOverlayToStore(440, k_EOverlayToStoreFlag_None)"))
        {
            SteamFriends.ActivateGameOverlayToStore((AppId_t)440, EOverlayToStoreFlag.k_EOverlayToStoreFlag_None);             // 440 = TF2
            print("SteamClient.ActivateGameOverlay(440, k_EOverlayToStoreFlag_None)");
        }

        if (GUILayout.Button("SteamFriends.SetPlayedWith(76561197991230424)"))
        {
            SteamFriends.SetPlayedWith(new CSteamID(76561197991230424));             //rlabrecque
            print("SteamClient.SetPlayedWith(76561197991230424)");
        }

        if (GUILayout.Button("SteamFriends.ActivateGameOverlayInviteDialog(76561197991230424)"))
        {
            SteamFriends.ActivateGameOverlayInviteDialog(new CSteamID(76561197991230424));             //rlabrecque
            print("SteamClient.ActivateGameOverlayInviteDialog(76561197991230424)");
        }

        if (GUILayout.Button("SteamFriends.GetSmallFriendAvatar(m_Friend)"))
        {
            int FriendAvatar = SteamFriends.GetSmallFriendAvatar(m_Friend);
            print("SteamFriends.GetSmallFriendAvatar(" + m_Friend + ") - " + FriendAvatar);

            uint ImageWidth;
            uint ImageHeight;
            bool ret = SteamUtils.GetImageSize(FriendAvatar, out ImageWidth, out ImageHeight);

            if (ret && ImageWidth > 0 && ImageHeight > 0)
            {
                byte[] Image = new byte[ImageWidth * ImageHeight * 4];

                ret = SteamUtils.GetImageRGBA(FriendAvatar, Image, (int)(ImageWidth * ImageHeight * 4));

                m_SmallAvatar = new Texture2D((int)ImageWidth, (int)ImageHeight, TextureFormat.RGBA32, false, true);
                m_SmallAvatar.LoadRawTextureData(Image);                 // The image is upside down! "@ares_p: in Unity all texture data starts from "bottom" (OpenGL convention)"
                m_SmallAvatar.Apply();
            }
        }

        if (GUILayout.Button("SteamFriends.GetMediumFriendAvatar(m_Friend)"))
        {
            int FriendAvatar = SteamFriends.GetMediumFriendAvatar(m_Friend);
            print("SteamFriends.GetMediumFriendAvatar(" + m_Friend + ") - " + FriendAvatar);

            uint ImageWidth;
            uint ImageHeight;
            bool ret = SteamUtils.GetImageSize(FriendAvatar, out ImageWidth, out ImageHeight);

            if (ret && ImageWidth > 0 && ImageHeight > 0)
            {
                byte[] Image = new byte[ImageWidth * ImageHeight * 4];

                ret            = SteamUtils.GetImageRGBA(FriendAvatar, Image, (int)(ImageWidth * ImageHeight * 4));
                m_MediumAvatar = new Texture2D((int)ImageWidth, (int)ImageHeight, TextureFormat.RGBA32, false, true);
                m_MediumAvatar.LoadRawTextureData(Image);
                m_MediumAvatar.Apply();
            }
        }

        if (GUILayout.Button("SteamFriends.GetLargeFriendAvatar(m_Friend)"))
        {
            int FriendAvatar = SteamFriends.GetLargeFriendAvatar(m_Friend);
            print("SteamFriends.GetLargeFriendAvatar(" + m_Friend + ") - " + FriendAvatar);

            uint ImageWidth;
            uint ImageHeight;
            bool ret = SteamUtils.GetImageSize(FriendAvatar, out ImageWidth, out ImageHeight);

            if (ret && ImageWidth > 0 && ImageHeight > 0)
            {
                byte[] Image = new byte[ImageWidth * ImageHeight * 4];

                ret = SteamUtils.GetImageRGBA(FriendAvatar, Image, (int)(ImageWidth * ImageHeight * 4));
                if (ret)
                {
                    m_LargeAvatar = new Texture2D((int)ImageWidth, (int)ImageHeight, TextureFormat.RGBA32, false, true);
                    m_LargeAvatar.LoadRawTextureData(Image);
                    m_LargeAvatar.Apply();
                }
            }
        }
    }
Beispiel #17
0
		public static extern bool ISteamGameServerUtils_IsAPICallCompleted(SteamAPICall_t hSteamAPICall, out bool pbFailed);
Beispiel #18
0
    // Submit current workshop item

    public void SubmitCurrentItem(string contentPath, string changeNote)
    {
        CheckInitialized();

        if (!HasCurrentItem())
        {
            throw new System.Exception("Unable to submit item, there is no current item");
        }

        Debug.Log("Submitting item #" + this.currentItem.itemId.m_PublishedFileId + " from path " + contentPath);

        UGCUpdateHandle_t handle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), this.currentItem.itemId);

        if (!string.IsNullOrEmpty(this.currentItem.title))
        {
            SteamUGC.SetItemTitle(handle, this.currentItem.title);
        }

        if (!string.IsNullOrEmpty(this.currentItem.description))
        {
            SteamUGC.SetItemDescription(handle, this.currentItem.description);
        }

        if (!string.IsNullOrEmpty(this.currentItem.previewImagePath))
        {
            SteamUGC.SetItemPreview(handle, this.currentItem.previewImagePath);
        }

        if (this.currentItem.tags != null && this.currentItem.tags.Count > 0)
        {
            SteamUGC.SetItemTags(handle, this.currentItem.tags);
        }

        if (this.currentItem.visibility != WorkshopItem.Visibility.NoChange)
        {
            ERemoteStoragePublishedFileVisibility visibility;

            if (this.currentItem.visibility == WorkshopItem.Visibility.Private)
            {
                visibility = ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate;
            }
            else if (this.currentItem.visibility == WorkshopItem.Visibility.FriendsOnly)
            {
                visibility = ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityFriendsOnly;
            }
            else
            {
                visibility = ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic;
            }

            SteamUGC.SetItemVisibility(handle, visibility);
        }

        SteamUGC.SetItemContent(handle, contentPath);

        SteamAPICall_t callback = SteamUGC.SubmitItemUpdate(handle, changeNote);

        this.submitItemResult.Set(callback);

        this.isUpdatingItem   = true;
        this.lastUpdateHandle = handle;
    }
		public static ESteamAPICallFailure GetAPICallFailureReason(SteamAPICall_t hSteamAPICall) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerUtils_GetAPICallFailureReason(hSteamAPICall);
		}
        /// <summary>
        /// This will connect a UDP client to a given UDP server
        /// </summary>
        /// <param name="host">The server's host address on the network</param>
        /// <param name="port">The port that the server is hosting on</param>
        /// <param name="natHost">The NAT server host address, if blank NAT will be skipped</param>
        /// <param name="natPort">The port that the NAT server is hosting on</param>
        /// <param name="pendCreates">Immidiately set the NetWorker::PendCreates to true</param>
        public void Connect(CSteamID hostId, bool pendCreates = false)
        {
            if (Disposed)
            {
                throw new ObjectDisposedException("UDPClient", "This object has been disposed and can not be used to connect, please use a new UDPClient");
            }

            if (hostId.IsLobby())
            {
                //If this is a lobby we need to join it, make direct connection to the owner.
                m_JoinCall     = SteamMatchmaking.JoinLobby(hostId);
                m_LobbyEntered = Callback <LobbyEnter_t> .Create((LobbyEnter_t data) =>
                {
                    LobbyID = (CSteamID)data.m_ulSteamIDLobby;
                    //Get the owner and attempt a direct connection
                    Connect(SteamMatchmaking.GetLobbyOwner(LobbyID), pendCreates);
                });

                return;
            }
            // By default pending creates should be true and flushed when ready
            if (!pendCreates)
            {
                PendCreates = true;
            }

            try
            {
                ushort clientPort = DEFAULT_PORT;

                // Make sure not to listen on the same port as the server for local networks
                if (clientPort == DEFAULT_PORT)
                {
                    clientPort++;
                }

                Client = new CachedSteamP2PClient(hostId);

                // Do any generic initialization in result of the successful bind
                OnBindSuccessful();

                // Get a random hash key that needs to be used for validating that the server was connected to
                headerHash = Websockets.HeaderHashKey();

                // This is a typical Websockets accept header to be validated
                byte[] connectHeader = Websockets.ConnectionHeader(headerHash, DEFAULT_PORT);

                // Setup the identity of the server as a player
                server = new NetworkingPlayer(0, hostId, true, this);

                // Create the thread that will be listening for new data from connected clients and start its execution
                Task.Queue(ReadNetwork);

                //Let myself know I connected successfully
                OnPlayerConnected(server);

                // Set myself as a connected client
                server.Connected = true;

                //Set the port
                SetPort(clientPort);

                int connectCounter = 0;
                Task.Queue(() =>
                {
                    do
                    {
                        // Send the accept headers to the server to validate
                        Client.Send(connectHeader, connectHeader.Length, hostId, EP2PSend.k_EP2PSendReliable);
                        Thread.Sleep(3000);
                    } while (!headerExchanged && IsBound && ++connectCounter < CONNECT_TRIES);

                    if (connectCounter >= CONNECT_TRIES)
                    {
                        if (connectAttemptFailed != null)
                        {
                            connectAttemptFailed(this);
                        }
                    }
                });

                m_CallbackP2PSessionConnectFail = Callback <P2PSessionConnectFail_t> .Create((P2PSessionConnectFail_t data) =>
                {
                    if (data.m_eP2PSessionError > 0)
                    {
                        Disconnect(true);
                        switch (data.m_eP2PSessionError)
                        {
                        case 1:
                            Logging.BMSLog.LogException("The target user is not running the same game."); break;

                        case 2:
                            Logging.BMSLog.LogException("The local user doesn't own the app that is running."); break;

                        case 3:
                            Logging.BMSLog.LogException("Target user isn't connected to Steam."); break;

                        case 4:
                            Logging.BMSLog.LogException("The connection timed out because the target user didn't respond, perhaps they aren't calling AcceptP2PSessionWithUser"); break;
                        }
                    }
                    //
                });
            }
            catch (Exception e)
            {
                Logging.BMSLog.LogException(e);
                // Do any generic initialization in result of the binding failure
                OnBindFailure();

                throw new FailedBindingException("Failed to bind to host/port, see inner exception", e);
            }
        }
    public void RenderOnGUI()
    {
        GUILayout.Label("SteamApps.BIsSubscribed() : " + SteamApps.BIsSubscribed());
        GUILayout.Label("SteamApps.BIsLowViolence() : " + SteamApps.BIsLowViolence());
        GUILayout.Label("SteamApps.BIsCybercafe() : " + SteamApps.BIsCybercafe());
        GUILayout.Label("SteamApps.BIsVACBanned() : " + SteamApps.BIsVACBanned());
        GUILayout.Label("SteamApps.GetCurrentGameLanguage() : " + SteamApps.GetCurrentGameLanguage());
        GUILayout.Label("SteamApps.GetAvailableGameLanguages() : " + SteamApps.GetAvailableGameLanguages());
        GUILayout.Label("SteamApps.BIsSubscribedApp(SteamUtils.GetAppID()) : " + SteamApps.BIsSubscribedApp(SteamUtils.GetAppID()));
        GUILayout.Label("SteamApps.BIsDlcInstalled(110902) : " + SteamApps.BIsDlcInstalled((AppId_t)110902));         // pieterw test DLC
        GUILayout.Label("SteamApps.GetEarliestPurchaseUnixTime(SteamUtils.GetAppID()) : " + SteamApps.GetEarliestPurchaseUnixTime(SteamUtils.GetAppID()));
        GUILayout.Label("SteamApps.BIsSubscribedFromFreeWeekend() : " + SteamApps.BIsSubscribedFromFreeWeekend());
        GUILayout.Label("SteamApps.GetDLCCount() : " + SteamApps.GetDLCCount());

        for (int iDLC = 0; iDLC < SteamApps.GetDLCCount(); ++iDLC)
        {
            AppId_t AppID;
            bool    Available;
            string  Name;
            bool    ret = SteamApps.BGetDLCDataByIndex(iDLC, out AppID, out Available, out Name, 128);
            GUILayout.Label("SteamApps.BGetDLCDataByIndex(" + iDLC + ", out AppID, out Available, out Name, 128) : " + ret + " -- " + AppID + " -- " + Available + " -- " + Name);
        }

        if (GUILayout.Button("SteamApps.InstallDLC(110902)"))
        {
            SteamApps.InstallDLC((AppId_t)110902);             // pieterw test DLC
        }

        if (GUILayout.Button("SteamApps.UninstallDLC(110902)"))
        {
            SteamApps.UninstallDLC((AppId_t)110902);             // pieterw test DLC
        }

        if (GUILayout.Button("SteamApps.RequestAppProofOfPurchaseKey(SteamUtils.GetAppID())"))
        {
            SteamApps.RequestAppProofOfPurchaseKey(SteamUtils.GetAppID());
        }

        {
            string Name;
            bool   ret = SteamApps.GetCurrentBetaName(out Name, 128);
            if (Name == null)
            {
                Name = "";
            }
            GUILayout.Label("SteamApps.GetCurrentBetaName(out Name, 128) : " + ret + " -- " + Name);
        }

        if (GUILayout.Button("SteamApps.MarkContentCorrupt(true)"))
        {
            print("SteamApps.MarkContentCorrupt(true) : " + SteamApps.MarkContentCorrupt(true));
        }

        if (GUILayout.Button("SteamApps.GetInstalledDepots(SteamUtils.GetAppID(), Depots, 32)"))
        {
            DepotId_t[] Depots = new DepotId_t[32];
            uint        ret    = SteamApps.GetInstalledDepots(SteamUtils.GetAppID(), Depots, 32);
            for (int i = 0; i < ret; ++i)
            {
                print("SteamApps.GetInstalledDepots(SteamUtils.GetAppID(), Depots, 32) : " + ret + " -- #" + i + " -- " + Depots[i]);
            }
        }

        {
            string Folder;
            uint   ret = SteamApps.GetAppInstallDir(SteamUtils.GetAppID(), out Folder, 260);
            if (Folder == null)
            {
                Folder = "";
            }

            GUILayout.Label("SteamApps.GetAppInstallDir(480, out Folder, 260) : " + ret + " -- " + Folder);
        }

        GUILayout.Label("SteamApps.BIsAppInstalled(480) : " + SteamApps.BIsAppInstalled(SteamUtils.GetAppID()));
        GUILayout.Label("SteamApps.GetAppOwner() : " + SteamApps.GetAppOwner());

        // Run the test and then use steam://run/480//?test=testing;param2=value2; in your browser to try this out
        GUILayout.Label("SteamApps.GetLaunchQueryParam(\"test\") : " + SteamApps.GetLaunchQueryParam("test"));

        {
            ulong BytesDownloaded;
            ulong BytesTotal;
            bool  ret = SteamApps.GetDlcDownloadProgress((AppId_t)110902, out BytesDownloaded, out BytesTotal);
            GUILayout.Label("SteamApps.GetDlcDownloadProgress((AppId_t)110902, out BytesDownloaded, out BytesTotal): " + ret + " -- " + BytesDownloaded + " -- " + BytesTotal);
        }

        GUILayout.Label("SteamApps.GetAppBuildId(): " + SteamApps.GetAppBuildId());
#if _PS3
        if (GUILayout.Button("SteamApps.RegisterActivationCode(\"???\")"))
        {
            SteamAPICall_t handle = SteamApps.RegisterActivationCode("???");
            new CallResult <RegisterActivationCodeResponse_t>(OnRegisterActivationCodeResponse, handle);
            new CallResult <AppProofOfPurchaseKeyResponse_t>(OnAppProofOfPurchaseKeyResponse, handle);
        }
#endif
    }
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_BeaconIndex: " + m_BeaconIndex);
        GUILayout.Label("m_PartyBeaconID: " + m_PartyBeaconID);
        GUILayout.Label("m_NumLocations: " + m_NumLocations);
        GUILayout.Label("m_BeaconLocationList: " + m_BeaconLocationList);
        GUILayout.Label("m_OtherUsersSteamID: " + m_OtherUsersSteamID);
        GUILayout.EndArea();

        GUILayout.BeginVertical("box");
        m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33));

        GUILayout.Label("GetNumActiveBeacons() : " + SteamParties.GetNumActiveBeacons());

        if (GUILayout.Button("GetBeaconByIndex(m_BeaconIndex)"))
        {
            m_PartyBeaconID = SteamParties.GetBeaconByIndex(m_BeaconIndex);
            print("SteamParties.GetBeaconByIndex(" + m_BeaconIndex + ") : " + m_PartyBeaconID);
        }

        if (GUILayout.Button("GetBeaconDetails(m_PartyBeaconID, out m_OtherUsersSteamID, out m_BeaconLocationList[0], out Metadata, 1024)"))
        {
            m_BeaconLocationList = new SteamPartyBeaconLocation_t[1];
            string Metadata;
            bool   ret = SteamParties.GetBeaconDetails(m_PartyBeaconID, out m_OtherUsersSteamID, out m_BeaconLocationList[0], out Metadata, 1024);
            print("SteamParties.GetBeaconDetails(" + m_PartyBeaconID + ", " + "out m_OtherUsersSteamID" + ", " + "out m_BeaconLocationList[0]" + ", " + "out Metadata" + ", " + 1024 + ") : " + ret + " -- " + m_OtherUsersSteamID + " -- " + m_BeaconLocationList[0] + " -- " + Metadata);
        }

        if (GUILayout.Button("JoinParty(m_PartyBeaconID)"))
        {
            SteamAPICall_t handle = SteamParties.JoinParty(m_PartyBeaconID);
            OnJoinPartyCallbackCallResult.Set(handle);
            print("SteamParties.JoinParty(" + m_PartyBeaconID + ") : " + handle);
        }

        if (GUILayout.Button("GetNumAvailableBeaconLocations(out m_NumLocations)"))
        {
            bool ret = SteamParties.GetNumAvailableBeaconLocations(out m_NumLocations);
            print("SteamParties.GetNumAvailableBeaconLocations(" + "out m_NumLocations" + ") : " + ret + " -- " + m_NumLocations);
        }

        if (GUILayout.Button("GetAvailableBeaconLocations(m_BeaconLocationList, m_NumLocations)"))
        {
            m_BeaconLocationList = new SteamPartyBeaconLocation_t[m_NumLocations];
            bool ret = SteamParties.GetAvailableBeaconLocations(m_BeaconLocationList, m_NumLocations);
            print("SteamParties.GetAvailableBeaconLocations(" + m_BeaconLocationList + ", " + m_NumLocations + ") : " + ret);
        }

        if (GUILayout.Button("CreateBeacon(1, ref m_BeaconLocationList[0], \"TestConnectString\", \"TestMetadata\")"))
        {
            SteamAPICall_t handle = SteamParties.CreateBeacon(1, ref m_BeaconLocationList[0], "TestConnectString", "TestMetadata");
            OnCreateBeaconCallbackCallResult.Set(handle);
            print("SteamParties.CreateBeacon(" + 1 + ", " + "ref m_BeaconLocationList[0]" + ", " + "\"TestConnectString\"" + ", " + "\"TestMetadata\"" + ") : " + handle + " -- " + m_BeaconLocationList[0]);
        }

        if (GUILayout.Button("OnReservationCompleted(m_PartyBeaconID, m_OtherUsersSteamID)"))
        {
            SteamParties.OnReservationCompleted(m_PartyBeaconID, m_OtherUsersSteamID);
            print("SteamParties.OnReservationCompleted(" + m_PartyBeaconID + ", " + m_OtherUsersSteamID + ")");
        }

        if (GUILayout.Button("CancelReservation(m_PartyBeaconID, m_OtherUsersSteamID)"))
        {
            SteamParties.CancelReservation(m_PartyBeaconID, m_OtherUsersSteamID);
            print("SteamParties.CancelReservation(" + m_PartyBeaconID + ", " + m_OtherUsersSteamID + ")");
        }

        if (GUILayout.Button("ChangeNumOpenSlots(m_PartyBeaconID, 2)"))
        {
            SteamAPICall_t handle = SteamParties.ChangeNumOpenSlots(m_PartyBeaconID, 2);
            OnChangeNumOpenSlotsCallbackCallResult.Set(handle);
            print("SteamParties.ChangeNumOpenSlots(" + m_PartyBeaconID + ", " + 2 + ") : " + handle);
        }

        if (GUILayout.Button("DestroyBeacon(m_PartyBeaconID)"))
        {
            bool ret = SteamParties.DestroyBeacon(m_PartyBeaconID);
            m_PartyBeaconID = PartyBeaconID_t.Invalid;
            print("SteamParties.DestroyBeacon(" + m_PartyBeaconID + ") : " + ret);
        }

        if (GUILayout.Button("GetBeaconLocationData(m_BeaconLocationList[0], ESteamPartyBeaconLocationData.k_ESteamPartyBeaconLocationDataName, out DataString, 1024)"))
        {
            string DataString;
            bool   ret = SteamParties.GetBeaconLocationData(m_BeaconLocationList[0], ESteamPartyBeaconLocationData.k_ESteamPartyBeaconLocationDataName, out DataString, 1024);
            print("SteamParties.GetBeaconLocationData(" + m_BeaconLocationList[0] + ", " + ESteamPartyBeaconLocationData.k_ESteamPartyBeaconLocationDataName + ", " + "out DataString" + ", " + 1024 + ") : " + ret + " -- " + DataString);
        }

        GUILayout.EndScrollView();
        GUILayout.EndVertical();
    }
Beispiel #23
0
    private void OnGUI()
    {
        string modName = typeof(ModEntryPoint).Assembly.GetName().Name;

        GUILayout.Label("Build Settings", EditorStyles.boldLabel);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Mod Name", modName);
        if (GUILayout.Button("Change"))
        {
            var obj = AssetDatabase.LoadAssetAtPath <Object>("Assets/Scripts/MyMod.asmdef");
            Selection.activeObject = obj;
            EditorGUIUtility.PingObject(obj);
        }
        EditorGUILayout.EndHorizontal();

        clearLogs        = GUILayout.Toggle(clearLogs, "Clear Logs");
        buildAssetBundle = GUILayout.Toggle(buildAssetBundle, "Build Asset Bundle");
        stripShaders     = GUILayout.Toggle(stripShaders, "Strip Shaders");

        if (GUILayout.Button("BUILD"))
        {
            if (modName.Length > 0)
            {
                ShaderBuildProcessor.SetEnabled(stripShaders);
                if (Directory.Exists(PATH_BUILD_BUNDLE))
                {
                    Directory.Delete(PATH_BUILD_BUNDLE, true);
                }

                if (Directory.Exists(PATH_BUILD_BUNDLE))
                {
                    throw new System.Exception("Temp/ModBuild exist");
                }

                if (!UnityEditor.SceneManagement.EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
                {
                    return;
                }

                UnityEditor.SceneManagement.EditorSceneManager.NewScene(UnityEditor.SceneManagement.NewSceneSetup.EmptyScene, UnityEditor.SceneManagement.NewSceneMode.Single);
                RenderSettings.fog = true; // force enable fog

                Directory.CreateDirectory(PATH_BUILD_BUNDLE);

                //HACK for unique id
                AssetImporter.GetAtPath("Assets/Resources").SetAssetBundleNameAndVariant(modName + "_resources", "");
                AssetDatabase.Refresh();

                if (buildAssetBundle)
                {
                    BuildPipeline.BuildAssetBundles(PATH_BUILD_BUNDLE, BuildAssetBundleOptions.None /*BuildAssetBundleOptions.DisableWriteTypeTree*/, BuildTarget.StandaloneWindows64);
                }

                if (clearLogs)
                {
                    ClearLogConsole();
                }

                //copy dll
                string modsFolder = Application.persistentDataPath + "/../../AtomTeam/Atom/Mods";

                if (!Directory.Exists(modsFolder))
                {
                    Directory.CreateDirectory(modsFolder);
                }

                Copy("Library/ScriptAssemblies/" + modName + ".dll", modsFolder + "/" + modName + ".dll");
                Copy("Library/ScriptAssemblies/" + modName + ".pdb", modsFolder + "/" + modName + ".pdb");

                //copy res
                string modResFolder = modsFolder;

                string dataAsset = Application.dataPath;
                int    index     = dataAsset.ToLower().IndexOf(PATH_TO_ASSETS);
                dataAsset = dataAsset.Remove(index, PATH_TO_ASSETS.Length);

                var resPath = dataAsset + "/Temp/ModBuild/" + modName + "_resources";
                if (File.Exists(resPath))
                {
                    Copy(resPath, modResFolder + "/" + modName + "_resources");
                }
                Copy("Library/ScriptAssemblies/" + modName + ".dll", "Temp/ModBuild/" + modName + ".dll");
                Copy("Library/ScriptAssemblies/" + modName + ".pdb", "Temp/ModBuild/" + modName + ".pdb");


                EditorUtility.RevealInFinder(modsFolder + "/" + modName + ".dll");

                AssetViewerDB.Load();
            }
        }

        GUILayout.Space(50);

        GUILayout.Label("Publish Settings", EditorStyles.boldLabel);

        if (steam.IsSign())
        {
            EditorGUILayout.LabelField("App Id", steam.GetAppId().ToString());

            if (_modIndex < 0)
            {
                for (int i = 0; i != _modList.Count; ++i)
                {
                    if (GUILayout.Button("Open Mod Item(" + _modList[i].m_rgchTitle + ")"))
                    {
                        _modIndex = i;
                    }
                }

                if (GUILayout.Button("Create New Mod Item"))
                {
                    SteamAPICall_t handle = SteamUGC.CreateItem(SteamUtils.GetAppID(), EWorkshopFileType.k_EWorkshopFileTypeCommunity);
                    OnCreateItemResultCallResult.Set(handle);
                }
            }
            else
            {
                SteamUGCDetails_t details = _modList[_modIndex]; //copy temp
                EditorGUILayout.LabelField("Mod Id", details.m_nPublishedFileId.ToString());
                details.m_rgchTitle       = EditorGUILayout.TextField("Title", details.m_rgchTitle);
                details.m_rgchDescription = EditorGUILayout.TextField("Description", details.m_rgchDescription);
                details.m_eVisibility     = (ERemoteStoragePublishedFileVisibility)EditorGUILayout.EnumPopup(details.m_eVisibility);
                _modList[_modIndex]       = details; //assign

                if (GUILayout.Button("Upload details"))
                {
                    var handle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), details.m_nPublishedFileId);
                    SteamUGC.SetItemTitle(handle, details.m_rgchTitle);
                    SteamUGC.SetItemDescription(handle, details.m_rgchDescription);
                    SteamUGC.SetItemVisibility(handle, details.m_eVisibility);
                    SteamAPICall_t callHandle = SteamUGC.SubmitItemUpdate(handle, "");
                    OnSubmitItemUpdateResultCallResult.Set(callHandle);
                }

                GUILayout.Space(20);

                EditorGUILayout.HelpBox("Select and upload preview image to Steam", MessageType.Info);

                if (GUILayout.Button("Upload preview image"))
                {
                    var handle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), details.m_nPublishedFileId);
                    SteamUGC.SetItemPreview(handle, EditorUtility.OpenFilePanel("Preview mod image", "", "png"));
                    SteamAPICall_t callHandle = SteamUGC.SubmitItemUpdate(handle, "");
                    OnSubmitItemUpdateResultCallResult.Set(callHandle);
                }

                GUILayout.Space(20);

                EditorGUILayout.HelpBox("Upload pre built mod content to Steam", MessageType.Info);

                if (GUILayout.Button("Upload content"))
                {
                    var handle = SteamUGC.StartItemUpdate(SteamUtils.GetAppID(), details.m_nPublishedFileId);

                    string dataAsset = Application.dataPath;
                    int    index     = dataAsset.ToLower().IndexOf(PATH_TO_ASSETS);
                    dataAsset = dataAsset.Remove(index, PATH_TO_ASSETS.Length);

                    string modsFolder = dataAsset + "/" + PATH_BUILD_BUNDLE;

                    SteamUGC.SetItemContent(handle, modsFolder);
                    SteamAPICall_t callHandle = SteamUGC.SubmitItemUpdate(handle, "");
                    OnSubmitItemUpdateResultCallResult.Set(callHandle);
                }
            }
        }
        else
        {
            EditorGUILayout.HelpBox("Attach to Steam account", MessageType.Warning);

            if (GUILayout.Button("Attach"))
            {
                RequestInfo();
            }
        }
    }
Beispiel #24
0
    private void RequestUpload(string update_message)
    {
        Debug.Log("Doing Steam Workshop upload");

        // Store metadata, but not ignore status
        prev_ignore = ignore;
        ignore      = false;
        UpdateMetadata();

        update_handle = SteamUGC.StartItemUpdate(SteamScript.RECEIVER1_APP_ID, steamworks_id);

        if (SteamUGC.SetItemTitle(update_handle, GetChars(name)) == false)
        {
            Debug.LogError("SetItemTitle failed");
        }

        if (SteamUGC.SetItemDescription(update_handle, GetChars(description)) == false)
        {
            Debug.LogError("SetItemDescription failed");
        }

        if (SteamUGC.SetItemUpdateLanguage(update_handle, "english") == false)
        {
            Debug.LogError("SetItemUpdateLanguage failed");
        }

        JSONObject jn = new JSONObject();

        jn.Add("author", new JSONString(GetChars(author)));
        jn.Add("version", new JSONString(GetChars(version)));

        if (SteamUGC.SetItemMetadata(update_handle, jn.ToString()) == false)
        {
            Debug.LogError("SetItemMetadata failed");
        }

        // Add custom tags
        string        tagString = GetChars(tags);
        List <string> taglist   = SteamScript.GetTagList(tagString);

        taglist.Add(mod.GetTypeString());   // Add mod type tag

        if (SteamUGC.SetItemTags(update_handle, taglist) == false)
        {
            Debug.LogError("SetItemTags failed");
        }

        // Add preview image
        string thumbnailPath = Path.Combine(mod.GetThumbnailPath());

        if (File.Exists(thumbnailPath))
        {
            SteamUGC.SetItemPreview(update_handle, thumbnailPath);
        }

        if (SteamUGC.SetItemVisibility(update_handle, visibility) == false)
        {
            Debug.LogError("SetItemVisibility failed");
        }

        string modpath = Path.GetDirectoryName(mod.path);

        if (Directory.Exists(modpath))
        {
            SteamUGC.SetItemContent(update_handle, modpath);
        }
        else
        {
            Debug.LogError("Invalid path for mod, unable to upload " + modpath);
            uploading = false;
            return;
        }

        SteamAPICall_t hSteamAPICall = SteamUGC.SubmitItemUpdate(update_handle, update_message);

        m_SubmitItemUpdateResult.Set(hSteamAPICall);
    }
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 120, 0, 120, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_UGCQueryHandle: " + m_UGCQueryHandle);
        GUILayout.Label("m_PublishedFileId: " + m_PublishedFileId);
        GUILayout.Label("m_UGCUpdateHandle: " + m_UGCUpdateHandle);
        GUILayout.EndArea();

        if (GUILayout.Button("CreateQueryUserUGCRequest(SteamUser.GetSteamID().GetAccountID(), EUserUGCList.k_EUserUGCList_Published, EUGCMatchingUGCType.k_EUGCMatchingUGCType_Screenshots, EUserUGCListSortOrder.k_EUserUGCListSortOrder_CreationOrderDesc, AppId_t.Invalid, SteamUtils.GetAppID(), 1)"))
        {
            m_UGCQueryHandle = SteamUGC.CreateQueryUserUGCRequest(SteamUser.GetSteamID().GetAccountID(), EUserUGCList.k_EUserUGCList_Published, EUGCMatchingUGCType.k_EUGCMatchingUGCType_Screenshots, EUserUGCListSortOrder.k_EUserUGCListSortOrder_CreationOrderDesc, AppId_t.Invalid, SteamUtils.GetAppID(), 1);
            print("SteamUGC.CreateQueryUserUGCRequest(" + SteamUser.GetSteamID().GetAccountID() + ", EUserUGCList.k_EUserUGCList_Published, EUGCMatchingUGCType.k_EUGCMatchingUGCType_Screenshots, EUserUGCListSortOrder.k_EUserUGCListSortOrder_CreationOrderDesc, " + AppId_t.Invalid + ", " + SteamUtils.GetAppID() + ", 1) : " + m_UGCQueryHandle);
        }

        if (GUILayout.Button("CreateQueryAllUGCRequest(EUGCQuery.k_EUGCQuery_RankedByPublicationDate, EUGCMatchingUGCType.k_EUGCMatchingUGCType_AllGuides, AppId_t.Invalid, SteamUtils.GetAppID(), 1)"))
        {
            m_UGCQueryHandle = SteamUGC.CreateQueryAllUGCRequest(EUGCQuery.k_EUGCQuery_RankedByPublicationDate, EUGCMatchingUGCType.k_EUGCMatchingUGCType_AllGuides, AppId_t.Invalid, SteamUtils.GetAppID(), 1);
            print("SteamUGC.CreateQueryAllUGCRequest(EUGCQuery.k_EUGCQuery_RankedByPublicationDate, EUGCMatchingUGCType.k_EUGCMatchingUGCType_AllGuides, " + AppId_t.Invalid + ", " + SteamUtils.GetAppID() + ", 1) : " + m_UGCQueryHandle);
        }

        if (GUILayout.Button("CreateQueryUGCDetailsRequest(PublishedFileIDs, (uint)PublishedFileIDs.Length)"))
        {
            PublishedFileId_t[] PublishedFileIDs = new PublishedFileId_t[] {
                (PublishedFileId_t)280762427,
                //(PublishedFileId_t)280664702,
            };
            m_UGCQueryHandle = SteamUGC.CreateQueryUGCDetailsRequest(PublishedFileIDs, (uint)PublishedFileIDs.Length);
            print("SteamUGC.CreateQueryUGCDetailsRequest(PublishedFileIDs, " + (uint)PublishedFileIDs.Length + ") : " + m_UGCQueryHandle);
        }

        if (GUILayout.Button("SendQueryUGCRequest(m_UGCQueryHandle)"))
        {
            SteamAPICall_t handle = SteamUGC.SendQueryUGCRequest(m_UGCQueryHandle);
            OnSteamUGCQueryCompletedCallResult.Set(handle);
            print("SteamUGC.SendQueryUGCRequest(" + m_UGCQueryHandle + ") : " + handle);
        }

        if (GUILayout.Button("GetQueryUGCResult(m_UGCQueryHandle, 0, out Details)"))
        {
            SteamUGCDetails_t Details;
            bool ret = SteamUGC.GetQueryUGCResult(m_UGCQueryHandle, 0, out Details);
            print("SteamUGC.GetQueryUGCResult(" + m_UGCQueryHandle + ", 0, out Details) : " + ret);
            print(Details.m_nPublishedFileId + " -- " + Details.m_eResult + " -- " + Details.m_eFileType + " -- " + Details.m_nCreatorAppID + " -- " + Details.m_nConsumerAppID + " -- " + Details.m_rgchTitle + " -- " + Details.m_rgchDescription + " -- " + Details.m_ulSteamIDOwner + " -- " + Details.m_rtimeCreated + " -- " + Details.m_rtimeUpdated + " -- " + Details.m_rtimeAddedToUserList + " -- " + Details.m_eVisibility + " -- " + Details.m_bBanned + " -- " + Details.m_bAcceptedForUse + " -- " + Details.m_bTagsTruncated + " -- " + Details.m_rgchTags + " -- " + Details.m_hFile + " -- " + Details.m_hPreviewFile + " -- " + Details.m_pchFileName + " -- " + Details.m_nFileSize + " -- " + Details.m_nPreviewFileSize + " -- " + Details.m_rgchURL + " -- " + Details.m_unVotesUp + " -- " + Details.m_unVotesDown + " -- " + Details.m_flScore + " -- " + Details.m_unNumChildren);
        }

        if (GUILayout.Button("GetQueryUGCPreviewURL(m_UGCQueryHandle, 0, out URL, 1024)"))
        {
            string URL;
            bool   ret = SteamUGC.GetQueryUGCPreviewURL(m_UGCQueryHandle, 0, out URL, 1024);
            print("SteamUGC.GetQueryUGCPreviewURL(" + m_UGCQueryHandle + ", 0, out URL, 1024) : " + ret + " -- " + URL);
        }

        if (GUILayout.Button("GetQueryUGCMetadata(m_UGCQueryHandle, 0, out Metadata, Constants.k_cchDeveloperMetadataMax)"))
        {
            string Metadata;
            bool   ret = SteamUGC.GetQueryUGCMetadata(m_UGCQueryHandle, 0, out Metadata, Constants.k_cchDeveloperMetadataMax);
            print("SteamUGC.GetQueryUGCMetadata(" + m_UGCQueryHandle + ", 0, out Metadata, " + Constants.k_cchDeveloperMetadataMax + ") : " + ret + " -- " + Metadata);
        }

        if (GUILayout.Button("GetQueryUGCChildren(m_UGCQueryHandle, 0, PublishedFileIDs, (uint)PublishedFileIDs.Length)"))
        {
            PublishedFileId_t[] PublishedFileIDs = new PublishedFileId_t[1];             // Use SteamUGCDetails_t::m_unNumChildren instead...
            bool ret = SteamUGC.GetQueryUGCChildren(m_UGCQueryHandle, 0, PublishedFileIDs, (uint)PublishedFileIDs.Length);
            print("SteamUGC.GetQueryUGCChildren(" + m_UGCQueryHandle + ", 0, PublishedFileIDs, " + (uint)PublishedFileIDs.Length + ") : " + ret + " -- " + PublishedFileIDs[0]);
        }

        if (GUILayout.Button("GetQueryUGCStatistic(m_UGCQueryHandle, 0, EItemStatistic.k_EItemStatistic_NumSubscriptions, out StatValue)"))
        {
            uint StatValue;
            bool ret = SteamUGC.GetQueryUGCStatistic(m_UGCQueryHandle, 0, EItemStatistic.k_EItemStatistic_NumSubscriptions, out StatValue);
            print("SteamUGC.GetQueryUGCStatistic(" + m_UGCQueryHandle + ", 0, EItemStatistic.k_EItemStatistic_NumSubscriptions, out StatValue) : " + ret + " -- " + StatValue);
        }

        if (GUILayout.Button("GetQueryUGCNumAdditionalPreviews(m_UGCQueryHandle, 0)"))
        {
            print("SteamUGC.GetQueryUGCNumAdditionalPreviews(" + m_UGCQueryHandle + ", 0) : " + SteamUGC.GetQueryUGCNumAdditionalPreviews(m_UGCQueryHandle, 0));
        }

        if (GUILayout.Button("GetQueryUGCAdditionalPreview(m_UGCQueryHandle, 0, 0, out URLOrVideoID, 1024, out IsImage)"))
        {
            string URLOrVideoID;
            bool   IsImage;
            bool   ret = SteamUGC.GetQueryUGCAdditionalPreview(m_UGCQueryHandle, 0, 0, out URLOrVideoID, 1024, out IsImage);           // Should check GetQueryUGCNumAdditionalPreviews first.
            print("SteamUGC.GetQueryUGCAdditionalPreview(" + m_UGCQueryHandle + ", 0, 0, out URLOrVideoID, 1024, out IsImage) : " + ret + " -- " + URLOrVideoID + " -- " + IsImage);
        }

        if (GUILayout.Button("GetQueryUGCNumKeyValueTags(m_UGCQueryHandle, 0)"))
        {
            uint ret = SteamUGC.GetQueryUGCNumKeyValueTags(m_UGCQueryHandle, 0);
            print("SteamUGC.GetQueryUGCNumKeyValueTags(" + m_UGCQueryHandle + ", 0) : " + ret);
        }

        if (GUILayout.Button("GetQueryUGCKeyValueTag(m_UGCQueryHandle, 0, 0, out Key, 260, out Value, 260)"))
        {
            string Key;
            string Value;
            bool   ret = SteamUGC.GetQueryUGCKeyValueTag(m_UGCQueryHandle, 0, 0, out Key, 260, out Value, 260);
            print("SteamUGC.GetQueryUGCKeyValueTag(" + m_UGCQueryHandle + ", 0, 0, out Key, 260, out Value, 260) : " + ret + " -- " + Key + " -- " + Value);
        }

        if (GUILayout.Button("ReleaseQueryUGCRequest(m_UGCQueryHandle)"))
        {
            print("SteamUGC.ReleaseQueryUGCRequest(" + m_UGCQueryHandle + ") : " + SteamUGC.ReleaseQueryUGCRequest(m_UGCQueryHandle));
        }

        if (GUILayout.Button("AddRequiredTag(m_UGCQueryHandle, \"Co-op\")"))
        {
            print("SteamUGC.AddRequiredTag(" + m_UGCQueryHandle + ", \"Co-op\") : " + SteamUGC.AddRequiredTag(m_UGCQueryHandle, "Co-op"));
        }

        if (GUILayout.Button("AddExcludedTag(m_UGCQueryHandle, \"Co-op\")"))
        {
            print("SteamUGC.AddExcludedTag(" + m_UGCQueryHandle + ", \"Co-op\") : " + SteamUGC.AddExcludedTag(m_UGCQueryHandle, "Co-op"));
        }

        if (GUILayout.Button("SetReturnKeyValueTags(m_UGCQueryHandle, true)"))
        {
            print("SteamUGC.SetReturnKeyValueTags(" + m_UGCQueryHandle + ", true) : " + SteamUGC.SetReturnKeyValueTags(m_UGCQueryHandle, true));
        }

        if (GUILayout.Button("SetReturnLongDescription(m_UGCQueryHandle, true)"))
        {
            print("SteamUGC.SetReturnLongDescription(" + m_UGCQueryHandle + ", true) : " + SteamUGC.SetReturnLongDescription(m_UGCQueryHandle, true));
        }

        if (GUILayout.Button("SetReturnMetadata(m_UGCQueryHandle, true)"))
        {
            print("SteamUGC.SetReturnMetadata(" + m_UGCQueryHandle + ", true) : " + SteamUGC.SetReturnMetadata(m_UGCQueryHandle, true));
        }

        if (GUILayout.Button("SetReturnChildren(m_UGCQueryHandle, true)"))
        {
            print("SteamUGC.SetReturnChildren(" + m_UGCQueryHandle + ", true) : " + SteamUGC.SetReturnChildren(m_UGCQueryHandle, true));
        }

        if (GUILayout.Button("SetReturnAdditionalPreviews(m_UGCQueryHandle, true)"))
        {
            print("SteamUGC.SetReturnAdditionalPreviews(" + m_UGCQueryHandle + ", true) : " + SteamUGC.SetReturnAdditionalPreviews(m_UGCQueryHandle, true));
        }

        if (GUILayout.Button("SetReturnTotalOnly(m_UGCQueryHandle, true)"))
        {
            print("SteamUGC.SetReturnTotalOnly(" + m_UGCQueryHandle + ", true) : " + SteamUGC.SetReturnTotalOnly(m_UGCQueryHandle, true));
        }

        if (GUILayout.Button("SetLanguage(m_UGCQueryHandle, \"english\")"))
        {
            print("SteamUGC.SetLanguage(" + m_UGCQueryHandle + ", \"english\") : " + SteamUGC.SetLanguage(m_UGCQueryHandle, "english"));
        }

        if (GUILayout.Button("SetAllowCachedResponse(m_UGCQueryHandle, 5)"))
        {
            print("SteamUGC.SetAllowCachedResponse(" + m_UGCQueryHandle + ", 5) : " + SteamUGC.SetAllowCachedResponse(m_UGCQueryHandle, 5));
        }

        if (GUILayout.Button("SetCloudFileNameFilter(m_UGCQueryHandle, \"\")"))
        {
            print("SteamUGC.SetCloudFileNameFilter(" + m_UGCQueryHandle + ", \"\") : " + SteamUGC.SetCloudFileNameFilter(m_UGCQueryHandle, ""));
        }

        if (GUILayout.Button("SetMatchAnyTag(m_UGCQueryHandle, true)"))
        {
            print("SteamUGC.SetMatchAnyTag(" + m_UGCQueryHandle + ", true) : " + SteamUGC.SetMatchAnyTag(m_UGCQueryHandle, true));
        }

        if (GUILayout.Button("SetSearchText(m_UGCQueryHandle, \"AciD\")"))
        {
            print("SteamUGC.SetSearchText(" + m_UGCQueryHandle + ", \"AciD\") : " + SteamUGC.SetSearchText(m_UGCQueryHandle, "AciD"));
        }

        if (GUILayout.Button("SetRankedByTrendDays(m_UGCQueryHandle, 7)"))
        {
            print("SteamUGC.SetRankedByTrendDays(" + m_UGCQueryHandle + ", 7) : " + SteamUGC.SetRankedByTrendDays(m_UGCQueryHandle, 7));
        }

        if (GUILayout.Button("AddRequiredKeyValueTag(m_UGCQueryHandle, \"TestKey\", \"TestValue\")"))
        {
            print("SteamUGC.AddRequiredKeyValueTag(" + m_UGCQueryHandle + ", \"TestKey\", \"TestValue\") : " + SteamUGC.AddRequiredKeyValueTag(m_UGCQueryHandle, "TestKey", "TestValue"));
        }

        if (GUILayout.Button("RequestUGCDetails(m_PublishedFileId, 5)"))
        {
            SteamAPICall_t handle = SteamUGC.RequestUGCDetails(m_PublishedFileId, 5);
            OnSteamUGCRequestUGCDetailsResultCallResult.Set(handle);
            print("SteamUGC.RequestUGCDetails(m_PublishedFileId, 5) : " + handle);
        }

        if (GUILayout.Button("CreateItem((AppId_t)480, EWorkshopFileType.k_EWorkshopFileTypeWebGuide)"))
        {
            SteamAPICall_t handle = SteamUGC.CreateItem((AppId_t)480, EWorkshopFileType.k_EWorkshopFileTypeWebGuide);
            OnCreateItemResultCallResult.Set(handle);
            print("SteamUGC.CreateItem((AppId_t)480, EWorkshopFileType.k_EWorkshopFileTypeWebGuide) : " + handle);
        }

        if (GUILayout.Button("StartItemUpdate((AppId_t)480, m_PublishedFileId)"))
        {
            m_UGCUpdateHandle = SteamUGC.StartItemUpdate((AppId_t)480, m_PublishedFileId);
            print("SteamUGC.StartItemUpdate((AppId_t)480, " + m_PublishedFileId + ") : " + m_UGCUpdateHandle);
        }

        if (GUILayout.Button("SetItemTitle(m_UGCUpdateHandle, \"This is a Test\")"))
        {
            bool ret = SteamUGC.SetItemTitle(m_UGCUpdateHandle, "This is a Test");
            print("SteamUGC.SetItemTitle(" + m_UGCUpdateHandle + ", \"This is a Test\") : " + ret);
        }

        if (GUILayout.Button("SetItemDescription(m_UGCUpdateHandle, \"This is the test description.\")"))
        {
            bool ret = SteamUGC.SetItemDescription(m_UGCUpdateHandle, "This is the test description.");
            print("SteamUGC.SetItemDescription(" + m_UGCUpdateHandle + ", \"This is the test description.\") : " + ret);
        }

        if (GUILayout.Button("SetItemUpdateLanguage(m_UGCUpdateHandle, \"english\")"))
        {
            bool ret = SteamUGC.SetItemUpdateLanguage(m_UGCUpdateHandle, "english");
            print("SteamUGC.SetItemUpdateLanguage(" + m_UGCUpdateHandle + ", \"english\") : " + ret);
        }

        if (GUILayout.Button("SetItemMetadata(m_UGCUpdateHandle, \"This is the test metadata.\")"))
        {
            bool ret = SteamUGC.SetItemMetadata(m_UGCUpdateHandle, "This is the test metadata.");
            print("SteamUGC.SetItemMetadata(" + m_UGCUpdateHandle + ", \"This is the test metadata.\") : " + ret);
        }

        if (GUILayout.Button("SetItemVisibility(m_UGCUpdateHandle, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate)"))
        {
            bool ret = SteamUGC.SetItemVisibility(m_UGCUpdateHandle, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate);
            print("SteamUGC.SetItemVisibility(" + m_UGCUpdateHandle + ", ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate) : " + ret);
        }

        if (GUILayout.Button("SetItemTags(m_UGCUpdateHandle, new string[] {\"Tag One\", \"Tag Two\", \"Test Tags\", \"Sorry\"})"))
        {
            bool ret = SteamUGC.SetItemTags(m_UGCUpdateHandle, new string[] { "Tag One", "Tag Two", "Test Tags", "Sorry" });
            print("SteamUGC.SetItemTags(" + m_UGCUpdateHandle + ", new string[] {\"Tag One\", \"Tag Two\", \"Test Tags\", \"Sorry\"}) : " + ret);
        }

        if (GUILayout.Button("SetItemContent(m_UGCUpdateHandle, Application.dataPath + \"/Scenes\")"))
        {
            bool ret = SteamUGC.SetItemContent(m_UGCUpdateHandle, Application.dataPath + "/Scenes");             // Should point to a folder containing the UGC Item
            print("SteamUGC.SetItemContent(" + m_UGCUpdateHandle + ", Application.dataPath + \"/Scenes\") : " + ret);
        }

        if (GUILayout.Button("SetItemPreview(m_UGCUpdateHandle, Application.dataPath + \"/controller.vdf\")"))
        {
            bool ret = SteamUGC.SetItemPreview(m_UGCUpdateHandle, Application.dataPath + "/controller.vdf");             // Should actually be a PNG/JPG Screenshot.
            print("SteamUGC.SetItemPreview(" + m_UGCUpdateHandle + ", Application.dataPath + \"/controller.vdf\") : " + ret);
        }

        if (GUILayout.Button("RemoveItemKeyValueTags(m_UGCUpdateHandle, \"TestKey\")"))
        {
            bool ret = SteamUGC.RemoveItemKeyValueTags(m_UGCUpdateHandle, "TestKey");
            print("SteamUGC.RemoveItemKeyValueTags(" + m_UGCUpdateHandle + "\"TestKey\") : " + ret);
        }

        if (GUILayout.Button("AddItemKeyValueTag(m_UGCUpdateHandle, \"TestKey\", \"TestValue\")"))
        {
            bool ret = SteamUGC.AddItemKeyValueTag(m_UGCUpdateHandle, "TestKey", "TestValue");
            print("SteamUGC.AddItemKeyValueTag(" + m_UGCUpdateHandle + "\"TestKey\", \"TestValue\") : " + ret);
        }

        if (GUILayout.Button("SubmitItemUpdate(m_UGCUpdateHandle, \"Test Changenote\")"))
        {
            SteamAPICall_t handle = SteamUGC.SubmitItemUpdate(m_UGCUpdateHandle, "Test Changenote");
            OnSubmitItemUpdateResultCallResult.Set(handle);
            print("SteamUGC.SubmitItemUpdate(" + m_UGCUpdateHandle + ", \"Test Changenote\") : " + handle);
        }

        {
            ulong             BytesProcessed;
            ulong             BytesTotal;
            EItemUpdateStatus ret = SteamUGC.GetItemUpdateProgress(m_UGCUpdateHandle, out BytesProcessed, out BytesTotal);
            GUILayout.Label("GetItemUpdateProgress(m_UGCUpdateHandle, out BytesProcessed, out BytesTotal) : " + ret + " -- " + BytesProcessed + " -- " + BytesTotal);
        }

        if (GUILayout.Button("SetUserItemVote((PublishedFileId_t)280762427, true)"))
        {
            SteamAPICall_t handle = SteamUGC.SetUserItemVote((PublishedFileId_t)280762427, true);             // http://steamcommunity.com/sharedfiles/filedetails/?id=280762427
            OnSetUserItemVoteResultCallResult.Set(handle);
            print("SteamUGC.SetUserItemVote((PublishedFileId_t)280762427, true) : " + handle);
        }

        if (GUILayout.Button("GetUserItemVote((PublishedFileId_t)280762427)"))
        {
            SteamAPICall_t handle = SteamUGC.GetUserItemVote((PublishedFileId_t)280762427);             // http://steamcommunity.com/sharedfiles/filedetails/?id=280762427
            OnGetUserItemVoteResultCallResult.Set(handle);
            print("SteamUGC.GetUserItemVote((PublishedFileId_t)280762427) : " + handle);
        }

        if (GUILayout.Button("AddItemToFavorites(SteamUtils.GetAppID(), (PublishedFileId_t)280762427)"))
        {
            SteamAPICall_t handle = SteamUGC.AddItemToFavorites(SteamUtils.GetAppID(), (PublishedFileId_t)280762427);             // http://steamcommunity.com/sharedfiles/filedetails/?id=280762427
            OnUserFavoriteItemsListChangedCallResult.Set(handle);
            print("SteamUGC.AddItemToFavorites(" + SteamUtils.GetAppID() + ", (PublishedFileId_t)280762427) : " + handle);
        }

        if (GUILayout.Button("RemoveItemFromFavorites(SteamUtils.GetAppID(), (PublishedFileId_t)280762427)"))
        {
            SteamAPICall_t handle = SteamUGC.RemoveItemFromFavorites(SteamUtils.GetAppID(), (PublishedFileId_t)280762427);             // http://steamcommunity.com/sharedfiles/filedetails/?id=280762427
            OnUserFavoriteItemsListChangedCallResult.Set(handle);
            print("SteamUGC.RemoveItemFromFavorites(" + SteamUtils.GetAppID() + ", (PublishedFileId_t)280762427) : " + handle);
        }

        if (GUILayout.Button("SubscribeItem((PublishedFileId_t)280762427)"))
        {
            SteamAPICall_t handle = SteamUGC.SubscribeItem((PublishedFileId_t)280762427);             // http://steamcommunity.com/sharedfiles/filedetails/?id=280762427
            OnRemoteStorageSubscribePublishedFileResultCallResult.Set(handle);
            print("SteamUGC.SubscribeItem((PublishedFileId_t)280762427) : " + handle);
        }

        if (GUILayout.Button("UnsubscribeItem((PublishedFileId_t)280762427)"))
        {
            SteamAPICall_t handle = SteamUGC.UnsubscribeItem((PublishedFileId_t)280762427);             // http://steamcommunity.com/sharedfiles/filedetails/?id=280762427
            OnRemoteStorageUnsubscribePublishedFileResultCallResult.Set(handle);
            print("SteamUGC.UnsubscribeItem((PublishedFileId_t)280762427) : " + handle);
        }

        GUILayout.Label("GetNumSubscribedItems() : " + SteamUGC.GetNumSubscribedItems());

        if (GUILayout.Button("GetSubscribedItems(PublishedFileID, (uint)PublishedFileID.Length)"))
        {
            PublishedFileId_t[] PublishedFileID = new PublishedFileId_t[1];
            uint ret = SteamUGC.GetSubscribedItems(PublishedFileID, (uint)PublishedFileID.Length);
            m_PublishedFileId = PublishedFileID[0];
            print("SteamUGC.GetSubscribedItems(" + PublishedFileID + ", (uint)PublishedFileID.Length) : " + ret + " -- " + PublishedFileID[0]);
        }

        GUILayout.Label("GetItemState(PublishedFileID) : " + (EItemState)SteamUGC.GetItemState(m_PublishedFileId));

        {
            ulong  SizeOnDisk;
            string Folder;
            uint   punTimeStamp;
            bool   ret = SteamUGC.GetItemInstallInfo(m_PublishedFileId, out SizeOnDisk, out Folder, 1024, out punTimeStamp);
            GUILayout.Label("GetItemInstallInfo(m_PublishedFileId, out SizeOnDisk, out Folder, 1024, out punTimeStamp) : " + ret + " -- " + SizeOnDisk + " -- " + Folder + " -- " + punTimeStamp);
        }

        {
            ulong BytesDownloaded;
            ulong BytesTotal;
            bool  ret = SteamUGC.GetItemDownloadInfo(m_PublishedFileId, out BytesDownloaded, out BytesTotal);
            GUILayout.Label("GetItemDownloadInfo(m_PublishedFileId, out BytesDownloaded, out BytesTotal) : " + ret + " -- " + BytesDownloaded + " -- " + BytesTotal);
        }

        if (GUILayout.Button("DownloadItem(PublishedFileID, true)"))
        {
            print("SteamUGC.DownloadItem(m_PublishedFileId, true) : " + SteamUGC.DownloadItem(m_PublishedFileId, true));
        }
    }
Beispiel #26
0
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_SteamInventoryResult: " + m_SteamInventoryResult);
        GUILayout.Label("m_SteamItemDetails: " + m_SteamItemDetails);
        GUILayout.Label("m_SteamItemDef: " + m_SteamItemDef);
        GUILayout.Label("m_SerializedBuffer: " + m_SerializedBuffer);
        GUILayout.EndArea();

        GUILayout.BeginVertical("box");
        m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33));

        // INVENTORY ASYNC RESULT MANAGEMENT

        GUILayout.Label("GetResultStatus(m_SteamInventoryResult) : " + SteamInventory.GetResultStatus(m_SteamInventoryResult));

        if (GUILayout.Button("GetResultItems(m_SteamInventoryResult, m_SteamItemDetails, ref OutItemsArraySize)"))
        {
            uint OutItemsArraySize = 0;
            bool ret = SteamInventory.GetResultItems(m_SteamInventoryResult, null, ref OutItemsArraySize);
            if (ret && OutItemsArraySize > 0)
            {
                m_SteamItemDetails = new SteamItemDetails_t[OutItemsArraySize];
                ret = SteamInventory.GetResultItems(m_SteamInventoryResult, m_SteamItemDetails, ref OutItemsArraySize);
                print("SteamInventory.GetResultItems(" + m_SteamInventoryResult + ", m_SteamItemDetails, out OutItemsArraySize) - " + ret + " -- " + OutItemsArraySize);

                System.Text.StringBuilder test = new System.Text.StringBuilder();
                for (int i = 0; i < OutItemsArraySize; ++i)
                {
                    test.AppendFormat("{0} - {1} - {2} - {3} - {4}\n", i, m_SteamItemDetails[i].m_itemId, m_SteamItemDetails[i].m_iDefinition, m_SteamItemDetails[i].m_unQuantity, m_SteamItemDetails[i].m_unFlags);
                }
                print(test);
            }
            else
            {
                print("SteamInventory.GetResultItems(" + m_SteamInventoryResult + ", null, out OutItemsArraySize) - " + ret + " -- " + OutItemsArraySize);
            }
        }

        if (GUILayout.Button("GetResultItemProperty(m_SteamInventoryResult, 0, null, out ValueBuffer, ref ValueBufferSize)"))
        {
            string ValueBuffer;
            uint   ValueBufferSize = 0;
            bool   ret             = SteamInventory.GetResultItemProperty(m_SteamInventoryResult, 0, null, out ValueBuffer, ref ValueBufferSize);
            if (ret)
            {
                ret = SteamInventory.GetResultItemProperty(m_SteamInventoryResult, 0, null, out ValueBuffer, ref ValueBufferSize);
            }
            print("SteamInventory.GetResultItemProperty(" + m_SteamInventoryResult + ", " + 0 + ", " + null + ", " + "out ValueBuffer" + ", " + "ref ValueBufferSize" + ") : " + ret + " -- " + ValueBuffer + " -- " + ValueBufferSize);
        }

        if (GUILayout.Button("GetResultTimestamp(m_SteamInventoryResult)"))
        {
            uint ret = SteamInventory.GetResultTimestamp(m_SteamInventoryResult);
            print("SteamInventory.GetResultTimestamp(" + m_SteamInventoryResult + ") : " + ret);
        }

        if (GUILayout.Button("CheckResultSteamID(m_SteamInventoryResult, SteamUser.GetSteamID())"))
        {
            bool ret = SteamInventory.CheckResultSteamID(m_SteamInventoryResult, SteamUser.GetSteamID());
            print("SteamInventory.CheckResultSteamID(" + m_SteamInventoryResult + ", " + SteamUser.GetSteamID() + ") : " + ret);
        }

        if (GUILayout.Button("DestroyResult(m_SteamInventoryResult)"))
        {
            DestroyResult();
        }

        // INVENTORY ASYNC QUERY

        if (GUILayout.Button("GetAllItems(out m_SteamInventoryResult)"))
        {
            bool ret = SteamInventory.GetAllItems(out m_SteamInventoryResult);
            print("SteamInventory.GetAllItems(" + "out m_SteamInventoryResult" + ") : " + ret + " -- " + m_SteamInventoryResult);
        }

        if (GUILayout.Button("GetItemsByID(out m_SteamInventoryResult, InstanceIDs, (uint)InstanceIDs.Length)"))
        {
            SteamItemInstanceID_t[] InstanceIDs = { (SteamItemInstanceID_t)0, (SteamItemInstanceID_t)1, };
            bool ret = SteamInventory.GetItemsByID(out m_SteamInventoryResult, InstanceIDs, (uint)InstanceIDs.Length);
            print("SteamInventory.GetItemsByID(" + "out m_SteamInventoryResult" + ", " + InstanceIDs + ", " + (uint)InstanceIDs.Length + ") : " + ret + " -- " + m_SteamInventoryResult);
        }

        // RESULT SERIALIZATION AND AUTHENTICATION

        if (GUILayout.Button("SerializeResult(m_SteamInventoryResult, m_SerializedBuffer, out OutBufferSize)"))
        {
            uint OutBufferSize;
            bool ret = SteamInventory.SerializeResult(m_SteamInventoryResult, null, out OutBufferSize);
            if (ret)
            {
                m_SerializedBuffer = new byte[OutBufferSize];
                ret = SteamInventory.SerializeResult(m_SteamInventoryResult, m_SerializedBuffer, out OutBufferSize);
                print("SteamInventory.SerializeResult(m_SteamInventoryResult, m_SerializedBuffer, out OutBufferSize) - " + ret + " -- " + OutBufferSize + " -- " + System.Text.Encoding.UTF8.GetString(m_SerializedBuffer, 0, m_SerializedBuffer.Length));
            }
            else
            {
                print("SteamInventory.SerializeResult(m_SteamInventoryResult, null, out OutBufferSize) - " + ret + " -- " + OutBufferSize);
            }
        }

        if (GUILayout.Button("DeserializeResult(out m_SteamInventoryResult, m_SerializedBuffer, (uint)m_SerializedBuffer.Length)"))
        {
            bool ret = SteamInventory.DeserializeResult(out m_SteamInventoryResult, m_SerializedBuffer, (uint)m_SerializedBuffer.Length);
            print("SteamInventory.DeserializeResult(" + "out m_SteamInventoryResult" + ", " + m_SerializedBuffer + ", " + (uint)m_SerializedBuffer.Length + ") : " + ret + " -- " + m_SteamInventoryResult);
        }

        // INVENTORY ASYNC MODIFICATION

        if (GUILayout.Button("GenerateItems(out m_SteamInventoryResult, ArrayItemDefs, null, (uint)ArrayItemDefs.Length)"))
        {
            SteamItemDef_t[] ArrayItemDefs = { ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration1, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration2 };
            bool             ret           = SteamInventory.GenerateItems(out m_SteamInventoryResult, ArrayItemDefs, null, (uint)ArrayItemDefs.Length);
            print("SteamInventory.GenerateItems(" + "out m_SteamInventoryResult" + ", " + ArrayItemDefs + ", " + null + ", " + (uint)ArrayItemDefs.Length + ") : " + ret + " -- " + m_SteamInventoryResult);
        }

        if (GUILayout.Button("GrantPromoItems(out m_SteamInventoryResult)"))
        {
            bool ret = SteamInventory.GrantPromoItems(out m_SteamInventoryResult);
            print("SteamInventory.GrantPromoItems(" + "out m_SteamInventoryResult" + ") : " + ret + " -- " + m_SteamInventoryResult);
        }

        if (GUILayout.Button("AddPromoItem(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1)"))
        {
            bool ret = SteamInventory.AddPromoItem(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1);
            print("SteamInventory.AddPromoItem(" + "out m_SteamInventoryResult" + ", " + ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1 + ") : " + ret + " -- " + m_SteamInventoryResult);
        }

        if (GUILayout.Button("AddPromoItems(out m_SteamInventoryResult, ArrayItemDefs, (uint)ArrayItemDefs.Length)"))
        {
            SteamItemDef_t[] ArrayItemDefs = { ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon2 };
            bool             ret           = SteamInventory.AddPromoItems(out m_SteamInventoryResult, ArrayItemDefs, (uint)ArrayItemDefs.Length);
            print("SteamInventory.AddPromoItems(" + "out m_SteamInventoryResult" + ", " + ArrayItemDefs + ", " + (uint)ArrayItemDefs.Length + ") : " + ret + " -- " + m_SteamInventoryResult);
        }

        if (GUILayout.Button("ConsumeItem(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1)"))
        {
            if (m_SteamItemDetails != null)
            {
                bool ret = SteamInventory.ConsumeItem(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1);
                print("SteamInventory.ConsumeItem(out m_SteamInventoryResult, " + m_SteamItemDetails[0].m_itemId + ", 1) - " + ret + " -- " + m_SteamInventoryResult);
            }
        }

        if (GUILayout.Button("ExchangeItems(TODO)"))
        {
            if (m_SteamItemDetails != null)
            {
                bool ret = SteamInventory.ExchangeItems(out m_SteamInventoryResult, null, null, 0, null, null, 0);                 // TODO
                print("SteamInventory.ExchangeItems(TODO) - " + ret + " -- " + m_SteamInventoryResult);
            }
        }

        if (GUILayout.Button("TransferItemQuantity(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1, SteamItemInstanceID_t.Invalid)"))
        {
            if (m_SteamItemDetails != null)
            {
                bool ret = SteamInventory.TransferItemQuantity(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1, SteamItemInstanceID_t.Invalid);
                print("SteamInventory.TransferItemQuantity(out m_SteamInventoryResult, " + m_SteamItemDetails[0].m_itemId + ", 1, SteamItemInstanceID_t.Invalid) - " + ret + " -- " + m_SteamInventoryResult);
            }
        }

        // TIMED DROPS AND PLAYTIME CREDIT

        if (GUILayout.Button("SendItemDropHeartbeat()"))
        {
            SteamInventory.SendItemDropHeartbeat();
            print("SteamInventory.SendItemDropHeartbeat()");
        }

        if (GUILayout.Button("TriggerItemDrop(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_TimedDropList)"))
        {
            bool ret = SteamInventory.TriggerItemDrop(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_TimedDropList);
            print("SteamInventory.TriggerItemDrop(" + "out m_SteamInventoryResult" + ", " + ESpaceWarItemDefIDs.k_SpaceWarItem_TimedDropList + ") : " + ret + " -- " + m_SteamInventoryResult);
        }

        // IN-GAME TRADING

        if (GUILayout.Button("TradeItems(TODO)"))
        {
            if (m_SteamItemDetails != null)
            {
                bool ret = SteamInventory.TradeItems(out m_SteamInventoryResult, SteamUser.GetSteamID(), null, null, 0, null, null, 0);                 // TODO... Difficult
                print("SteamInventory.TradeItems(TODO) - " + ret + " -- " + m_SteamInventoryResult);
            }
        }

        // ITEM DEFINITIONS

        if (GUILayout.Button("LoadItemDefinitions()"))
        {
            bool ret = SteamInventory.LoadItemDefinitions();
            print("SteamInventory.LoadItemDefinitions() : " + ret);
        }

        if (GUILayout.Button("GetItemDefinitionIDs(ItemDefIDs, ref length)"))
        {
            uint length = 0;
            bool ret    = SteamInventory.GetItemDefinitionIDs(null, ref length);
            if (ret)
            {
                m_SteamItemDef = new SteamItemDef_t[length];
                ret            = SteamInventory.GetItemDefinitionIDs(m_SteamItemDef, ref length);
                print("SteamInventory.GetItemDefinitionIDs(m_SteamItemDef, ref length) - " + ret + " -- " + length);
            }
            else
            {
                print("SteamInventory.GetItemDefinitionIDs(null, ref length) - " + ret + " -- " + length);
            }
        }

        if (GUILayout.Button("GetItemDefinitionProperty(ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration1, null, out ValueBuffer, ref length)"))
        {
            uint   length = 2048;
            string ValueBuffer;
            bool   ret = SteamInventory.GetItemDefinitionProperty(ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration1, null, out ValueBuffer, ref length);
            print("SteamInventory.GetItemDefinitionProperty(" + ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration1 + ", " + null + ", " + "out ValueBuffer" + ", " + "ref length" + ") : " + ret + " -- " + ValueBuffer + " -- " + length);
        }

        if (GUILayout.Button("RequestEligiblePromoItemDefinitionsIDs(SteamUser.GetSteamID())"))
        {
            SteamAPICall_t handle = SteamInventory.RequestEligiblePromoItemDefinitionsIDs(SteamUser.GetSteamID());
            OnSteamInventoryEligiblePromoItemDefIDsCallResult.Set(handle);
            print("SteamInventory.RequestEligiblePromoItemDefinitionsIDs(" + SteamUser.GetSteamID() + ") : " + handle);
        }

        //SteamInventory.GetEligiblePromoItemDefinitionIDs() // Should be handled within the SteamInventoryEligiblePromoItemDefIDs_t CallResult!

        //SteamInventory.StartPurchase() // TODO

        //SteamInventory.RequestPrices() // TODO

        //SteamInventory.GetNumItemsWithPrices() // TODO

        //SteamInventory.GetItemsWithPrices() // TODO

        //SteamInventory.GetItemPrice() // TODO

        //SteamInventory.StartUpdateProperties() // TODO

        //SteamInventory.RemoveProperty() // TODO

        //SteamInventory.SetProperty() // TODO

        //SteamInventory.SetProperty() // TODO

        //SteamInventory.SetProperty() // TODO

        //SteamInventory.SetProperty() // TODO

        //SteamInventory.SubmitUpdateProperties() // TODO

        GUILayout.EndScrollView();
        GUILayout.EndVertical();
    }
Beispiel #27
0
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_Image:");
        GUILayout.Label(m_Image);
        GUILayout.EndArea();

        GUILayout.Label("SteamUtils.GetSecondsSinceAppActive() : " + SteamUtils.GetSecondsSinceAppActive());
        GUILayout.Label("SteamUtils.GetConnectedUniverse() : " + SteamUtils.GetConnectedUniverse());
        GUILayout.Label("SteamUtils.GetServerRealTime() : " + SteamUtils.GetServerRealTime());
        GUILayout.Label("SteamUtils.GetIPCountry() : " + SteamUtils.GetIPCountry());

        {
            uint ImageWidth  = 0;
            uint ImageHeight = 0;
            bool ret         = SteamUtils.GetImageSize(1, out ImageWidth, out ImageHeight);
            GUILayout.Label("SteamUtils.GetImageSize(1, out ImageWidth, out ImageHeight) : " + ret + " -- " + ImageWidth + " -- " + ImageHeight);

            if (GUILayout.Button("SteamUtils.GetImageRGBA(1, Image, (int)(ImageWidth * ImageHeight * 4)"))
            {
                if (ImageWidth > 0 && ImageHeight > 0)
                {
                    byte[] Image = new byte[ImageWidth * ImageHeight * 4];
                    ret = SteamUtils.GetImageRGBA(1, Image, (int)(ImageWidth * ImageHeight * 4));
                    print("SteamUtils.GetImageRGBA(1, " + Image + ", " + (int)(ImageWidth * ImageHeight * 4) + ") - " + ret + " -- " + ImageWidth + " -- " + ImageHeight);
                    if (ret)
                    {
                        m_Image = new Texture2D((int)ImageWidth, (int)ImageHeight, TextureFormat.RGBA32, false, true);
                        m_Image.LoadRawTextureData(Image);
                        m_Image.Apply();
                    }
                }
            }
        }

        {
            uint   IP;
            ushort Port;
            bool   ret = SteamUtils.GetCSERIPPort(out IP, out Port);
            GUILayout.Label("SteamUtils.GetCSERIPPort(out IP, out Port) : " + ret + " -- " + IP + " -- " + Port);
        }

        GUILayout.Label("SteamUtils.GetCurrentBatteryPower() : " + SteamUtils.GetCurrentBatteryPower());
        GUILayout.Label("SteamUtils.GetAppID() : " + SteamUtils.GetAppID());

        if (GUILayout.Button("SteamUtils.SetOverlayNotificationPosition(k_EPositionTopRight)"))
        {
            SteamUtils.SetOverlayNotificationPosition(ENotificationPosition.k_EPositionTopRight);
            print("SteamUtils.SetOverlayNotificationPosition(k_EPositionTopRight)");
        }

        //GUILayout.Label("SteamUtils.IsAPICallCompleted() : " + SteamUtils.IsAPICallCompleted()); // N/A - These 3 functions are used to dispatch CallResults.
        //GUILayout.Label("SteamUtils.GetAPICallFailureReason() : " + SteamUtils.GetAPICallFailureReason()); // N/A
        //GUILayout.Label("SteamUtils.GetAPICallResult() : " + SteamUtils.GetAPICallResult()); // N/A

        if (GUILayout.Button("SteamUtils.RunFrame()"))
        {
            SteamUtils.RunFrame();
            print("SteamUtils.RunFrame()");
        }

        GUILayout.Label("SteamUtils.GetIPCCallCount() : " + SteamUtils.GetIPCCallCount());

        //GUILayout.Label("SteamUtils.SetWarningMessageHook() : " + SteamUtils.SetWarningMessageHook()); // N/A - Check out SteamTest.cs for example usage.

        GUILayout.Label("SteamUtils.IsOverlayEnabled() : " + SteamUtils.IsOverlayEnabled());
        GUILayout.Label("SteamUtils.BOverlayNeedsPresent() : " + SteamUtils.BOverlayNeedsPresent());

        if (GUILayout.Button("SteamUtils.CheckFileSignature(\"FileNotFound.txt\")"))
        {
            SteamAPICall_t handle = SteamUtils.CheckFileSignature("FileNotFound.txt");
            OnCheckFileSignatureCallResult.Set(handle);
            print("SteamUtils.CheckFileSignature(\"FileNotFound.txt\") - " + handle);
        }

        if (GUILayout.Button("SteamUtils.ShowGamepadTextInput(k_EGamepadTextInputModeNormal, k_EGamepadTextInputLineModeSingleLine, \"Description Test!\", 32)"))
        {
            bool ret = SteamUtils.ShowGamepadTextInput(EGamepadTextInputMode.k_EGamepadTextInputModeNormal, EGamepadTextInputLineMode.k_EGamepadTextInputLineModeSingleLine, "Description Test!", 32, "");
            print("SteamUtils.ShowGamepadTextInput(k_EGamepadTextInputModeNormal, k_EGamepadTextInputLineModeSingleLine, \"Description Test!\", 32) - " + ret);
        }

        GUILayout.Label("SteamUtils.GetEnteredGamepadTextLength() : " + SteamUtils.GetEnteredGamepadTextLength());         // TODO - only to be called from within OnGamepadTextInputDismissed?

        {
            string Text;
            bool   ret = SteamUtils.GetEnteredGamepadTextInput(out Text, 32);
            GUILayout.Label("SteamUtils.GetEnteredGamepadTextInput(out Text, 32) - " + ret + " -- " + Text);
        }

        GUILayout.Label("SteamUtils.GetSteamUILanguage() : " + SteamUtils.GetSteamUILanguage());
    }
    public void CreateLobby()
    {
        SteamAPICall_t handle = SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, 3);

        m_LobbyCreated.Set(handle);
    }
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_Init: " + m_Init);
        GUILayout.Label("m_HHTMLBrowser: " + m_HHTMLBrowser);
        GUILayout.Label("m_URL: " + m_URL);
        GUILayout.Label("m_Texture: " + m_Texture);
        GUILayout.Label("m_Width: " + m_Width);
        GUILayout.Label("m_Height: " + m_Height);
        GUILayout.Label("m_CanGoBack: " + m_CanGoBack);
        GUILayout.Label("m_CanGoForward: " + m_CanGoForward);
        GUILayout.Label("m_Rect: " + m_Rect);
        GUILayout.Label("m_LastMousePos: " + m_LastMousePos);
        GUILayout.Label("m_VerticalScrollMax: " + m_VerticalScrollMax);
        GUILayout.Label("m_VeritcalScrollCurrent: " + m_VeritcalScrollCurrent);
        GUILayout.Label("m_HorizontalScrollMax: " + m_HorizontalScrollMax);
        GUILayout.Label("m_HorizontalScrollCurrent: " + m_HorizontalScrollCurrent);
        GUILayout.Label("m_SetKeyFocus: " + m_SetKeyFocus);
        GUILayout.Label("m_Find: " + m_Find);
        GUILayout.Label("m_CurrentlyInFind: " + m_CurrentlyInFind);
        GUILayout.Label("m_ScaleFactor: " + m_ScaleFactor);
        GUILayout.Label("m_BackgroundMode: " + m_BackgroundMode);
        GUILayout.EndArea();

        if (m_Texture)
        {
            GUI.DrawTexture(m_Rect, m_Texture);
        }

        if (!m_Init)
        {
            GUILayout.Label("SteamHTMLSurface.Init() returned false");
            return;
        }

        //SteamHTMLSurface.Init() // N/A - Called in OnEnable

        //SteamHTMLSurface.Shutdown() // N/A - Called in OnDisable

        if (GUILayout.Button("CreateBrowser(\"SpaceWars Test\", null)"))
        {
            RemoveBrowser();             // Remove an old browser if it exists.
            SteamAPICall_t handle = SteamHTMLSurface.CreateBrowser("SpaceWars Test", null);
            OnHTML_BrowserReadyCallResult.Set(handle);
            print("SteamHTMLSurface.CreateBrowser(" + "\"SpaceWars Test\"" + ", " + null + ") : " + handle);
        }

        if (GUILayout.Button("RemoveBrowser(m_HHTMLBrowser)"))
        {
            RemoveBrowser();
        }

        m_URL = GUILayout.TextField(m_URL);
        if (GUILayout.Button("LoadURL(m_HHTMLBrowser, m_URL, null)"))
        {
            SteamHTMLSurface.LoadURL(m_HHTMLBrowser, m_URL, null);
            print("SteamHTMLSurface.LoadURL(" + m_HHTMLBrowser + ", " + m_URL + ", " + null + ")");
        }

        if (GUILayout.Button("SetSize(m_HHTMLBrowser, m_Width, m_Height)"))
        {
            m_Width   = (uint)Screen.width - WidthOffset;
            m_Height  = (uint)Screen.height - HeightOffset;
            m_Rect    = new Rect(WidthOffset, m_Height + HeightOffset, m_Width, -m_Height);          // This flips the viewport since Unity renders textures upside down.
            m_Texture = null;
            SteamHTMLSurface.SetSize(m_HHTMLBrowser, m_Width, m_Height);
            print("SteamHTMLSurface.SetSize(" + m_HHTMLBrowser + ", " + m_Width + ", " + m_Height + ")");
        }

        if (GUILayout.Button("StopLoad(m_HHTMLBrowser)"))
        {
            SteamHTMLSurface.StopLoad(m_HHTMLBrowser);
            print("SteamHTMLSurface.StopLoad(" + m_HHTMLBrowser + ")");
        }

        if (GUILayout.Button("Reload(m_HHTMLBrowser)"))
        {
            SteamHTMLSurface.Reload(m_HHTMLBrowser);
            print("SteamHTMLSurface.Reload(" + m_HHTMLBrowser + ")");
        }

        GUI.enabled = m_CanGoBack;
        if (GUILayout.Button("GoBack(m_HHTMLBrowser)"))
        {
            SteamHTMLSurface.GoBack(m_HHTMLBrowser);
            print("SteamHTMLSurface.GoBack(" + m_HHTMLBrowser + ")");
        }

        GUI.enabled = m_CanGoForward;
        if (GUILayout.Button("GoForward(m_HHTMLBrowser)"))
        {
            SteamHTMLSurface.GoForward(m_HHTMLBrowser);
            print("SteamHTMLSurface.GoForward(" + m_HHTMLBrowser + ")");
        }

        GUI.enabled = true;
        if (GUILayout.Button("AddHeader(m_HHTMLBrowser, \"From\", \"[email protected]\")"))
        {
            SteamHTMLSurface.AddHeader(m_HHTMLBrowser, "From", "*****@*****.**");
            print("SteamHTMLSurface.AddHeader(" + m_HHTMLBrowser + ", " + "\"From\"" + ", " + "\"[email protected]\"" + ")");
        }

        if (GUILayout.Button("ExecuteJavascript(m_HHTMLBrowser, \"window.alert('Test');\")"))
        {
            SteamHTMLSurface.ExecuteJavascript(m_HHTMLBrowser, "window.alert('Test');");
            print("SteamHTMLSurface.ExecuteJavascript(" + m_HHTMLBrowser + ", " + "\"window.alert('Test');\"" + ")");
        }

        //SteamHTMLSurface.MouseUp() // All interaction calls are dealt with at the end of OnGUI

        //SteamHTMLSurface.MouseDown() // All interaction calls are dealt with at the end of OnGUI

        //SteamHTMLSurface.MouseDoubleClick() // All interaction calls are dealt with at the end of OnGUI

        //SteamHTMLSurface.MouseMove() // All interaction calls are dealt with at the end of OnGUI

        //SteamHTMLSurface.MouseWheel() // All interaction calls are dealt with at the end of OnGUI

        //SteamHTMLSurface.KeyDown() // All interaction calls are dealt with at the end of OnGUI

        //SteamHTMLSurface.KeyUp() // All interaction calls are dealt with at the end of OnGUI

        //SteamHTMLSurface.KeyChar() // All interaction calls are dealt with at the end of OnGUI

        //SteamHTMLSurface.SetHorizontalScroll() // All interaction calls are dealt with at the end of OnGUI

        //SteamHTMLSurface.SetVerticalScroll() // All interaction calls are dealt with at the end of OnGUI

        if (GUILayout.Button("SetKeyFocus(m_HHTMLBrowser, !m_SetKeyFocus)"))
        {
            SteamHTMLSurface.SetKeyFocus(m_HHTMLBrowser, !m_SetKeyFocus);
            print("SteamHTMLSurface.SetKeyFocus(" + m_HHTMLBrowser + ", " + !m_SetKeyFocus + ")");
            m_SetKeyFocus = !m_SetKeyFocus;
        }

        if (GUILayout.Button("ViewSource(m_HHTMLBrowser)"))
        {
            SteamHTMLSurface.ViewSource(m_HHTMLBrowser);
            print("SteamHTMLSurface.ViewSource(" + m_HHTMLBrowser + ")");
        }

        if (GUILayout.Button("CopyToClipboard(m_HHTMLBrowser)"))
        {
            SteamHTMLSurface.CopyToClipboard(m_HHTMLBrowser);
            print("SteamHTMLSurface.CopyToClipboard(" + m_HHTMLBrowser + ")");
        }

        if (GUILayout.Button("PasteFromClipboard(m_HHTMLBrowser)"))
        {
            SteamHTMLSurface.PasteFromClipboard(m_HHTMLBrowser);
            print("SteamHTMLSurface.PasteFromClipboard(" + m_HHTMLBrowser + ")");
        }

        m_Find = GUILayout.TextField(m_Find);
        if (GUILayout.Button("Find(m_HHTMLBrowser, m_Find, m_CurrentlyInFind, false)"))
        {
            SteamHTMLSurface.Find(m_HHTMLBrowser, m_Find, m_CurrentlyInFind, false);
            print("SteamHTMLSurface.Find(" + m_HHTMLBrowser + ", " + m_Find + ", " + m_CurrentlyInFind + ", " + false + ")");
            m_CurrentlyInFind = true;
        }

        if (GUILayout.Button("StopFind(m_HHTMLBrowser)"))
        {
            SteamHTMLSurface.StopFind(m_HHTMLBrowser);
            print("SteamHTMLSurface.StopFind(" + m_HHTMLBrowser + ")");
            m_CurrentlyInFind = false;
        }

        if (GUILayout.Button("GetLinkAtPosition(m_HHTMLBrowser, (500 - WidthOffset), (120 - HeightOffset))"))
        {
            SteamHTMLSurface.GetLinkAtPosition(m_HHTMLBrowser, (500 - WidthOffset), (120 - HeightOffset));
            print("SteamHTMLSurface.GetLinkAtPosition(" + m_HHTMLBrowser + ", " + (500 - WidthOffset) + ", " + (120 - HeightOffset) + ")");
        }

        if (GUILayout.Button("SetCookie(m_URL, \"testcookiekey\", \"testcookievalue\")"))
        {
            // Use with http://httpbin.org/cookies
            SteamHTMLSurface.SetCookie(m_URL, "testcookiekey", "testcookievalue");
            print("SteamHTMLSurface.SetCookie(" + m_URL + ", " + "\"testcookiekey\"" + ", " + "\"testcookievalue\"" + ")");
        }

        m_ScaleFactor = GUILayout.HorizontalScrollbar(m_ScaleFactor, 0.25f, 0f, 2f);
        if (GUILayout.Button("SetPageScaleFactor(m_HHTMLBrowser, m_ScaleFactor, 0, 0)"))
        {
            SteamHTMLSurface.SetPageScaleFactor(m_HHTMLBrowser, m_ScaleFactor, 0, 0);
            print("SteamHTMLSurface.SetPageScaleFactor(" + m_HHTMLBrowser + ", " + m_ScaleFactor + ", " + 0 + ", " + 0 + ")");
        }

        if (GUILayout.Button("SetBackgroundMode(m_HHTMLBrowser, m_BackgroundMode)"))
        {
            SteamHTMLSurface.SetBackgroundMode(m_HHTMLBrowser, m_BackgroundMode);
            print("SteamHTMLSurface.SetBackgroundMode(" + m_HHTMLBrowser + ", " + m_BackgroundMode + ")");
            m_BackgroundMode = !m_BackgroundMode;
        }

        //SteamHTMLSurface.AllowStartRequest() // ['N/A - You MUST call this in response to a HTML_StartRequest_t callback']

        //SteamHTMLSurface.JSDialogResponse() // [' N/A - You MUST call this in response to a HTML_JSAlert_t or HTML_JSConfirm_t callback']

        //SteamHTMLSurface.FileLoadDialogResponse() // N/A - You MUST call this in response to a HTML_FileOpenDialog_t callback

        if (m_HHTMLBrowser == HHTMLBrowser.Invalid)
        {
            return;
        }

        // We set the moust position before checking for mouse presses just incase the mouse moved in the same OnGUI frame as a mouse press.
        Event e = Event.current;

        if (e.mousePosition != m_LastMousePos)
        {
            if ((e.mousePosition.x >= WidthOffset && e.mousePosition.x <= m_Width + WidthOffset) && (e.mousePosition.y >= HeightOffset && e.mousePosition.y <= m_Height + HeightOffset))
            {
                m_LastMousePos = e.mousePosition;
                SteamHTMLSurface.MouseMove(m_HHTMLBrowser, (int)(e.mousePosition.x - WidthOffset), (int)(e.mousePosition.y - HeightOffset));
            }
        }

        //virtual void MouseDoubleClick( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) = 0; //TODO
        switch (e.type)
        {
        case EventType.MouseDown:
            SteamHTMLSurface.MouseDown(m_HHTMLBrowser, (EHTMLMouseButton)e.button);
            break;

        case EventType.MouseUp:
            SteamHTMLSurface.MouseUp(m_HHTMLBrowser, (EHTMLMouseButton)e.button);
            break;

        case EventType.ScrollWheel:
            SteamHTMLSurface.MouseWheel(m_HHTMLBrowser, (int)(-e.delta.y * 100));
            break;

        case EventType.KeyDown:
            //print("KeyDown: " + e.keyCode + " - " + (int)e.character + " - " + e.character);
            EHTMLKeyModifiers modifiers = EHTMLKeyModifiers.k_eHTMLKeyModifier_None;
            if (e.alt)
            {
                modifiers = modifiers | EHTMLKeyModifiers.k_eHTMLKeyModifier_AltDown;
            }
            if (e.shift)
            {
                modifiers = modifiers | EHTMLKeyModifiers.k_eHTMLKeyModifier_ShiftDown;
            }
            if (e.control)
            {
                modifiers = modifiers | EHTMLKeyModifiers.k_eHTMLKeyModifier_CtrlDown;
            }

            if (e.keyCode != KeyCode.None)
            {
                SteamHTMLSurface.KeyDown(m_HHTMLBrowser, (uint)e.keyCode, modifiers);
            }
            if (e.character != 0)
            {
                SteamHTMLSurface.KeyChar(m_HHTMLBrowser, (uint)e.character, modifiers);
            }

            if (e.keyCode == KeyCode.DownArrow)
            {
                m_VeritcalScrollCurrent = System.Math.Min(m_VeritcalScrollCurrent + 100, m_VerticalScrollMax);
                SteamHTMLSurface.SetVerticalScroll(m_HHTMLBrowser, m_VeritcalScrollCurrent);
            }
            else if (e.keyCode == KeyCode.UpArrow)
            {
                if (m_VeritcalScrollCurrent - 100 > m_VeritcalScrollCurrent)                         // Underflow
                {
                    m_VeritcalScrollCurrent = 0;
                }
                else
                {
                    m_VeritcalScrollCurrent -= 100;
                }
                SteamHTMLSurface.SetVerticalScroll(m_HHTMLBrowser, m_VeritcalScrollCurrent);
            }
            else if (e.keyCode == KeyCode.RightArrow)
            {
                m_HorizontalScrollCurrent = System.Math.Min(m_HorizontalScrollCurrent + 100, m_HorizontalScrollMax);
                SteamHTMLSurface.SetHorizontalScroll(m_HHTMLBrowser, m_HorizontalScrollCurrent);
            }
            else if (e.keyCode == KeyCode.LeftArrow)
            {
                if (m_HorizontalScrollCurrent - 100 > m_HorizontalScrollCurrent)                         // Underflow
                {
                    m_HorizontalScrollCurrent = 0;
                }
                else
                {
                    m_HorizontalScrollCurrent -= 100;
                }
                SteamHTMLSurface.SetHorizontalScroll(m_HHTMLBrowser, m_HorizontalScrollCurrent);
            }
            break;

        case EventType.KeyUp:
            //print("KeyUp: " + e.keyCode + " - " + (int)e.character + " - " + e.character);
            modifiers = EHTMLKeyModifiers.k_eHTMLKeyModifier_None;
            if (e.alt)
            {
                modifiers = modifiers | EHTMLKeyModifiers.k_eHTMLKeyModifier_AltDown;
            }
            if (e.shift)
            {
                modifiers = modifiers | EHTMLKeyModifiers.k_eHTMLKeyModifier_ShiftDown;
            }
            if (e.control)
            {
                modifiers = modifiers | EHTMLKeyModifiers.k_eHTMLKeyModifier_CtrlDown;
            }

            if (e.keyCode != KeyCode.None)
            {
                SteamHTMLSurface.KeyUp(m_HHTMLBrowser, (uint)e.keyCode, modifiers);
            }
            break;
        }
    }
    public void GetLobbyList()
    {
        SteamAPICall_t handle = SteamMatchmaking.RequestLobbyList();

        m_LobbyMatchList.Set(handle);
    }
Beispiel #31
0
		public static extern bool ISteamHTTP_SendHTTPRequest(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle);
    public void EnterLobby(CSteamID LobbyId)
    {
        SteamAPICall_t handle = SteamMatchmaking.JoinLobby(LobbyId);

        m_LobbyEnter.Set(handle);
    }
Beispiel #33
0
		public static extern bool ISteamGameServerHTTP_SendHTTPRequestAndStreamResponse(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle);
Beispiel #34
0
 public static bool SendHTTPRequestAndStreamResponse(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamGameServerHTTP_SendHTTPRequestAndStreamResponse(hRequest, out pCallHandle));
 }
Beispiel #35
0
		public static extern ESteamAPICallFailure ISteamGameServerUtils_GetAPICallFailureReason(SteamAPICall_t hSteamAPICall);
Beispiel #36
0
    /*/ Start is called before the first frame update
     * void Start()
     * {
     *  // We start by hiding the lobby canvas, this will be shown later
     *  lobby_canvas.enabled = false;
     *
     *  if(SteamManager.Initialized)
     *  {
     *      name = SteamFriends.GetPersonaName();
     *      player_labels[0].text = name;
     *      LobbyCreated_t lobby_status = (LobbyCreated_t) SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypeFriendsOnly, 4);
     *  }
     *
     * }*/

    public void OnPlayButtonClick()
    {
        SteamAPICall_t lobby_status = SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypeFriendsOnly, 4);
    }
		/// <summary>
		/// <para> API asynchronous call results</para>
		/// <para> can be used directly, but more commonly used via the callback dispatch API (see steam_api.h)</para>
		/// </summary>
		public static bool IsAPICallCompleted(SteamAPICall_t hSteamAPICall, out bool pbFailed) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerUtils_IsAPICallCompleted(hSteamAPICall, out pbFailed);
		}
    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("GetHSteamUser() : " + SteamUser.GetHSteamUser());
        GUILayout.Label("BLoggedOn() : " + SteamUser.BLoggedOn());
        GUILayout.Label("GetSteamID() : " + SteamUser.GetSteamID());

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

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

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

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

        {
            uint         Compressed;
            uint         Uncompressed;
            EVoiceResult ret = SteamUser.GetAvailableVoice(out Compressed, out Uncompressed, 11025);
            GUILayout.Label("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("GetVoiceOptimalSampleRate() : " + SteamUser.GetVoiceOptimalSampleRate());

        {
            if (GUILayout.Button("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("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("EndAuthSession(SteamUser.GetSteamID())"))
        {
            SteamUser.EndAuthSession(SteamUser.GetSteamID());
            print("SteamUser.EndAuthSession(" + SteamUser.GetSteamID() + ")");
        }

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

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

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

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

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

        //GUILayout.Label("GetGameBadgeLevel(1, false) : " + SteamUser.GetGameBadgeLevel(1, false)); // SpaceWar does not have trading cards, so this function will only ever return 0 and produce an annoying warning.
        GUILayout.Label("GetPlayerSteamLevel() : " + SteamUser.GetPlayerSteamLevel());

        if (GUILayout.Button("RequestStoreAuthURL(\"https://steampowered.com\")"))
        {
            SteamAPICall_t handle = SteamUser.RequestStoreAuthURL("https://steampowered.com");
            OnStoreAuthURLResponseCallResult.Set(handle);
            print("SteamUser.RequestStoreAuthURL(\"https://steampowered.com\") - " + handle);
        }

#if _PS3
        //GUILayout.Label("LogOn() : " + SteamUser.LogOn());
        //GUILayout.Label("LogOnAndLinkSteamAccountToPSN : " + SteamUser.LogOnAndLinkSteamAccountToPSN());
        //GUILayout.Label("LogOnAndCreateNewSteamAccountIfNeeded : " + SteamUser.LogOnAndCreateNewSteamAccountIfNeeded());
        //GUILayout.Label("GetConsoleSteamID : " + SteamUser.GetConsoleSteamID());
#endif
    }
		public static bool GetAPICallResult(SteamAPICall_t hSteamAPICall, IntPtr pCallback, int cubCallback, int iCallbackExpected, out bool pbFailed) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerUtils_GetAPICallResult(hSteamAPICall, pCallback, cubCallback, iCallbackExpected, out pbFailed);
		}
    //public void playVoiceIfAvailable()
    //{
    //    uint Compressed;
    //    uint Uncompressed;
    //    ret = SteamUser.GetAvailableVoice(out Compressed, out Uncompressed, 11025);


    //    if (ret == EVoiceResult.k_EVoiceResultOK && Compressed > 0)
    //    {
    //        //Console.WriteLine("GetAvailableVoice(out Compressed, out Uncompressed, 11025) : " + ret + " -- " + Compressed + " -- " + Uncompressed);
    //        uint BytesWritten;
    //        uint UncompressedBytesWritten;
    //        ret = SteamUser.GetVoice(true, DestBuffer, 1024, out BytesWritten, true, UncompressedDestBuffer, (uint)DestBuffer.Length, out UncompressedBytesWritten, 11025);
    //        //Console.WriteLine("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)
    //        {

    //            uint BytesWritten2;
    //            ret = SteamUser.DecompressVoice(DestBuffer, BytesWritten, DestBuffer2, (uint)DestBuffer2.Length, out BytesWritten2, 11025);
    //            //Console.WriteLine("SteamUser.DecompressVoice(DestBuffer, BytesWritten, DestBuffer2, (uint)DestBuffer2.Length, out BytesWritten2, 11025) - " + ret + " -- " + BytesWritten2);

    //            if (ret == EVoiceResult.k_EVoiceResultOK && BytesWritten2 > 0)
    //            {

    //                //converts to doubles?
    //                //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);

    //                MemoryStream stream = new MemoryStream(DestBuffer2);

    //                SoundEffect sound = new SoundEffect(stream.ToArray(), 11025, AudioChannels.Mono);
    //                sound.Play();

    //                stream.Dispose();
    //                //sound.Dispose();

    //                ////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>();
    //                //}


    //                //source.Play();
    //            }
    //        }
    //    }
    //}



    //Client A must retrieve a session ticket by calling SteamUser()->GetAuthSessionTicket().
    //Client A must send its session ticket to client B.
    //Client B must pass client A's ticket to SteamUser()->BeginAuthSession(), which will perform a quick validity check. If the ticket is valid, BeginAuthSession() will forward the ticket to then the Steam backend to verify that the ticket has not been reused and was issued by the account owner of client A. The result of this verification will be returned in a ValidateAuthTicketResponse_t callback.
    //When the multiplayer session terminates:
    //    Client A must pass the handle initially returned from GetAuthSessionTicket() to SteamUser()->CancelAuthTicket().
    //    Client B must pass the SteamID of client A to SteamUser()->EndAuthSession().


    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("GetHSteamUser() : " + SteamUser.GetHSteamUser());
        //GUILayout.Label("BLoggedOn() : " + SteamUser.BLoggedOn());
        //GUILayout.Label("GetSteamID() : " + SteamUser.GetSteamID());

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

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

        //if (GUILayout.Button("StartVoiceRecording()"))
        {
            SteamUser.StartVoiceRecording();
            Console.WriteLine("SteamUser.StartVoiceRecording()");
        }

        //if (GUILayout.Button("StopVoiceRecording()"))
        {
            SteamUser.StopVoiceRecording();
            Console.WriteLine("SteamUser.StopVoiceRecording()");
        }

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

            {
                //if (GUILayout.Button("GetAuthSessionTicket(Ticket, 1024, out pcbTicket)"))
                {
                    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);
                }

                //if (GUILayout.Button("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());
                        Console.WriteLine("SteamUser.BeginAuthSession(m_Ticket, " + (int)m_pcbTicket + ", " + SteamUser.GetSteamID() + ") - " + ret);
                    }
                    else
                    {
                        Console.WriteLine("Call GetAuthSessionTicket first!");
                    }
                }
            }

            //if (GUILayout.Button("EndAuthSession(SteamUser.GetSteamID())"))
            {
                SteamUser.EndAuthSession(SteamUser.GetSteamID());
                Console.WriteLine("SteamUser.EndAuthSession(" + SteamUser.GetSteamID() + ")");
            }

            //if (GUILayout.Button("CancelAuthTicket(m_HAuthTicket)"))
            {
                SteamUser.CancelAuthTicket(m_HAuthTicket);
                Console.WriteLine("SteamUser.CancelAuthTicket(" + m_HAuthTicket + ")");
            }

            Console.WriteLine("UserHasLicenseForApp(SteamUser.GetSteamID(), SteamUtils.GetAppID()) : " + SteamUser.UserHasLicenseForApp(SteamUser.GetSteamID(), SteamUtils.GetAppID()));
            Console.WriteLine("BIsBehindNAT() : " + SteamUser.BIsBehindNAT());

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

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

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

            //GUILayout.Label("GetGameBadgeLevel(1, false) : " + SteamUser.GetGameBadgeLevel(1, false)); // SpaceWar does not have trading cards, so this function will only ever return 0 and produce an annoying warning.
            Console.WriteLine("GetPlayerSteamLevel() : " + SteamUser.GetPlayerSteamLevel());

            //if (GUILayout.Button("RequestStoreAuthURL(\"https://steampowered.com\")"))
            {
                SteamAPICall_t handle = SteamUser.RequestStoreAuthURL("https://steampowered.com");
                OnStoreAuthURLResponseCallResult.Set(handle);
                Console.WriteLine("SteamUser.RequestStoreAuthURL(\"https://steampowered.com\") - " + handle);
            }

#if _PS3
            //GUILayout.Label("LogOn() : " + SteamUser.LogOn());
            //GUILayout.Label("LogOnAndLinkSteamAccountToPSN : " + SteamUser.LogOnAndLinkSteamAccountToPSN());
            //GUILayout.Label("LogOnAndCreateNewSteamAccountIfNeeded : " + SteamUser.LogOnAndCreateNewSteamAccountIfNeeded());
            //GUILayout.Label("GetConsoleSteamID : " + SteamUser.GetConsoleSteamID());
#endif
        }
    }
		/// <summary>
		/// <para> Sends the HTTP request, will return false on a bad handle, otherwise use SteamCallHandle to wait on</para>
		/// <para> asynchronous response via callback for completion, and listen for HTTPRequestHeadersReceived_t and</para>
		/// <para> HTTPRequestDataReceived_t callbacks while streaming.</para>
		/// </summary>
		public static bool SendHTTPRequestAndStreamResponse(HTTPRequestHandle hRequest, out SteamAPICall_t pCallHandle) {
			InteropHelp.TestIfAvailableGameServer();
			return NativeMethods.ISteamGameServerHTTP_SendHTTPRequestAndStreamResponse(hRequest, out pCallHandle);
		}
Beispiel #42
0
    /// <summary>
    /// Performs all actions related to the game start event.
    /// </summary>
    /// <param name="e">The game start event.</param>
    private void PerformGameStartActions(Event e)
    {
        ingame = true;

        startTime   = Time.time;
        currentMode = e.mode;

        playerDeath = 0;

        //find leaderboard
        SteamAPICall_t findHandle = SteamUserStats.FindLeaderboard(e.level + " - " + e.playerCount);

        LeaderboardFindResult.Set(findHandle, OnLeaderboardFindResult);

        //playercount achievements
        if (e.playerCount == 1)
        {
            UnlockAchievement(AchievementID.ACH_PLAY_ALONE);
        }
        else if (e.playerCount == 4)
        {
            UnlockAchievement(AchievementID.ACH_PLAY_WITH_FOUR);
        }

        if (e.mobilePlayers > 0)
        {
            UnlockAchievement(AchievementID.ACH_SMARTPHONE_JOIN);
        }

        //reset powerups
        characterPowerups.Clear();
        totalPowerups = 0;

        foreach (string character in e.characters)
        {
            switch (character) //fill bitwise to save info in just one int
            {
            case "Timeshifter":
                if ((charactersPlayed & 1) != 1)
                {
                    charactersPlayed += 1;
                }
                break;

            case "Birdman":
                if ((charactersPlayed & 2) != 2)
                {
                    charactersPlayed += 2;
                }
                break;

            case "Charger":
                if ((charactersPlayed & 4) != 4)
                {
                    charactersPlayed += 4;
                }
                break;

            case "Fatman":
                if ((charactersPlayed & 8) != 8)
                {
                    charactersPlayed += 8;
                }
                break;

            case "Babuschka":
                if ((charactersPlayed & 16) != 16)
                {
                    charactersPlayed += 16;
                }
                break;

            case "Pantomime":
                if ((charactersPlayed & 32) != 32)
                {
                    charactersPlayed += 32;
                }
                break;

            case "Tomic":
                if ((charactersPlayed & 64) != 64)
                {
                    charactersPlayed += 64;
                }
                break;
            }
            characterPowerups.Add(character, 0);
        }
    }