如何在Unity C#中使用Steam Web API? RemovePlayerGameBan(),ReportPlayerCheating(),ISteamUserAuth / AuthenticateUserTicket等

问题描述 投票:-3回答:1

我正在使用Unity创建多人FPS,我希望很快发布它。我终于设法使Steam游戏服务器工作正常(使用相同的服务器浏览器等),但是我还没有弄清楚如何对玩家进行身份验证,启用VAC并确保他们没有被禁止使用VAC。另外我也不知道如何使用诸如RequestPlayerGameBan(),ReportPlayerCheating()等方法。我知道其中一些方法正在使用Steam Web API,但是我不知道如何使用它,Valve的Steamworks文档没有真的帮助我理解了这一点。

我正在使用Unity创建多人FPS,我希望很快发布它。我终于设法使Steam游戏服务器的东西正常工作(使用相同的服务器浏览器等),但是我没有想到...

c# unity3d steam steam-web-api
1个回答
0
投票
async static void PostReportPlayerCheating(string url, string key, string steamid, string steamidreporter, string appdata) { IEnumerable<KeyValuePair<string, string>> queries = new List<KeyValuePair<string, string>>() { new KeyValuePair<string, string>("key",key), new KeyValuePair<string,string>("steamid",steamid), new KeyValuePair<string,string>("appid","1155580"), new KeyValuePair<string,string>("steamidreporter",steamidreporter), new KeyValuePair<string,string>("appdata",appdata) }; HttpContent q = new FormUrlEncodedContent(queries); using (HttpClient client = new HttpClient()) { using (HttpResponseMessage response = await client.PostAsync(url, q)) { using (HttpContent content = response.Content) { string myContent = await content.ReadAsStringAsync(); //HttpContentHeaders headers = content.Headers; Debug.Log(myContent); outputInputField.text = myContent; string json = JsonUtility.ToJson(myContent); string path = Application.dataPath + "/asyncPostRequest.json"; File.WriteAllText(path, json); } } } } async static void PostRequestPlayerGameBan(string url, string key, string steamid, string reportid, string cheatdescription,string duration, string delayban,string flags) { IEnumerable<KeyValuePair<string, string>> queries = new List<KeyValuePair<string, string>>() { new KeyValuePair<string, string>("key",key), new KeyValuePair<string,string>("steamid",steamid), new KeyValuePair<string,string>("appid","1155580"), new KeyValuePair<string,string>("reportid",reportid), new KeyValuePair<string,string>("cheatdescription",cheatdescription), new KeyValuePair<string,string>("duration",duration), new KeyValuePair<string,string>("delayban",delayban), new KeyValuePair<string,string>("flags",flags) }; HttpContent q = new FormUrlEncodedContent(queries); using (HttpClient client = new HttpClient()) { using (HttpResponseMessage response = await client.PostAsync(url, q)) { using (HttpContent content = response.Content) { string myContent = await content.ReadAsStringAsync(); //HttpContentHeaders headers = content.Headers; Debug.Log(myContent); outputInputField.text = myContent; } } } } async static void PostRemovePlayerGameBan(string url, string key, string steamid) { IEnumerable<KeyValuePair<string, string>> queries = new List<KeyValuePair<string, string>>() { new KeyValuePair<string, string>("key",key), new KeyValuePair<string,string>("steamid",steamid), new KeyValuePair<string,string>("appid","1155580") }; HttpContent q = new FormUrlEncodedContent(queries); using (HttpClient client = new HttpClient()) { using (HttpResponseMessage response = await client.PostAsync(url, q)) { using (HttpContent content = response.Content) { string myContent = await content.ReadAsStringAsync(); //HttpContentHeaders headers = content.Headers; Debug.Log(myContent); outputInputField.text = myContent; string json = JsonUtility.ToJson(myContent); string path = Application.dataPath + "/asyncPostRequest.json"; File.WriteAllText(path, json); } } } }
© www.soinside.com 2019 - 2024. All rights reserved.