hold音符补丁 备份
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Steamworks;
|
||||
|
||||
public class steamCheck : MonoBehaviour
|
||||
{
|
||||
[Header("UI")]
|
||||
public Text welcomeText;
|
||||
|
||||
private const uint APP_ID = 2191270;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
// 如果不是从Steam启动,Steam会自动拉起并重新启动游戏
|
||||
if (SteamAPI.RestartAppIfNecessary(new AppId_t(APP_ID)))
|
||||
{
|
||||
Application.Quit();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// 初始化Steam
|
||||
if (!SteamAPI.Init())
|
||||
{
|
||||
Debug.LogError("SteamAPI 初始化失败");
|
||||
Application.Quit();
|
||||
return;
|
||||
}
|
||||
|
||||
SetWelcomeText();
|
||||
}
|
||||
|
||||
void SetWelcomeText()
|
||||
{
|
||||
if (welcomeText == null)
|
||||
return;
|
||||
|
||||
if (!SteamUser.BLoggedOn())
|
||||
return;
|
||||
|
||||
string playerName = SteamFriends.GetPersonaName();
|
||||
CSteamID steamID = SteamUser.GetSteamID();
|
||||
|
||||
welcomeText.text = $"欢迎,专员测试1用户 {playerName} ({steamID.m_SteamID})";
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (SteamAPI.IsSteamRunning())
|
||||
SteamAPI.RunCallbacks();
|
||||
}
|
||||
|
||||
void OnApplicationQuit()
|
||||
{
|
||||
if (SteamAPI.IsSteamRunning())
|
||||
SteamAPI.Shutdown();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user