728x90
백문이 불어일견 -_- 국내에선 검색도 안되냐 이런 중요한게
예제
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Steamworks;
using System.Text;
public class Main : MonoBehaviour {
const string MY_WEBAPI = "your web api";
const int MY_APPID = 0; // your app id
HAuthTicket m_AuthSessionTicket;
byte[] m_Ticket = new byte[1024];
uint m_pcbTicket;
protected Callback<GetAuthSessionTicketResponse_t> m_GetAuthSessionTicketResponse;
private void Awake()
{
m_GetAuthSessionTicketResponse = Callback<GetAuthSessionTicketResponse_t>.Create(OnGetAuthSessionTicketResponse);
}
// Use this for initialization
void Start () {
if(SteamManager.Initialized)
m_AuthSessionTicket = SteamUser.GetAuthSessionTicket(m_Ticket, m_Ticket.Length, out m_pcbTicket);
}
void OnGetAuthSessionTicketResponse(GetAuthSessionTicketResponse_t pCallback)
{
Debug.Log("[" + GetAuthSessionTicketResponse_t.k_iCallback + " - GetAuthSessionTicketResponse] - " + pCallback.m_hAuthTicket + " -- " + pCallback.m_eResult);
if (pCallback.m_eResult == EResult.k_EResultOK)
{
if (m_AuthSessionTicket != HAuthTicket.Invalid && m_pcbTicket != 0)
{
System.Array.Resize(ref m_Ticket, (int)m_pcbTicket);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < m_pcbTicket; i++)
sb.AppendFormat("{0:x2}", m_Ticket[i]);
StartCoroutine(TestWebApi(sb.ToString()));
}
}
}
IEnumerator TestWebApi(string s)
{
string url = string.Format("https://api.steampowered.com/ISteamUserAuth/AuthenticateUserTicket/v1/?key={0}&appid={1}&ticket={2}",
MY_WEBAPI,
MY_APPID,
s);
WWW www = new WWW(url);
yield return www;
if (www.error == null)
Debug.Log("### Success " + www.text);
else
Debug.Log("### Failed " + www.text);
m_sDebug = www.text;
}
string m_sDebug = "";
private void OnGUI()
{
if(m_sDebug != "")
GUI.Label(new Rect(30, 30, 800, 300), m_sDebug);
}
}
728x90
'프로그래밍 > Unity' 카테고리의 다른 글
Steam ISteamMicroTxnSandbox InitTxn (0) | 2019.01.30 |
---|---|
마우스 화면 밖으로 나가지 않게 하기 (0) | 2018.12.10 |
cannot mark assets and scenes in one assetbundle (0) | 2018.10.04 |
m_AssetBundleManifest 이 null 일 때 (0) | 2018.09.28 |
FPS (Frame Per Sec) Display 표시, 출력하기 (0) | 2018.09.10 |
댓글