notebook实装功能,galgame继续,一些bug修复
This commit is contained in:
+31
-9
@@ -9,10 +9,11 @@ public class steamCheck : MonoBehaviour
|
||||
|
||||
private const uint APP_ID = 2191270;
|
||||
|
||||
private bool steamInitialized = false;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
// 如果不是从Steam启动,Steam会自动拉起并重新启动游戏
|
||||
if (SteamAPI.RestartAppIfNecessary(new AppId_t(APP_ID)))
|
||||
{
|
||||
Application.Quit();
|
||||
@@ -20,14 +21,26 @@ public class steamCheck : MonoBehaviour
|
||||
}
|
||||
#endif
|
||||
|
||||
// 初始化Steam
|
||||
if (!SteamAPI.Init())
|
||||
try
|
||||
{
|
||||
Debug.LogError("SteamAPI 初始化失败");
|
||||
Application.Quit();
|
||||
steamInitialized = SteamAPI.Init();
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Debug.LogError("Steam 初始化异常: " + e);
|
||||
steamInitialized = false;
|
||||
}
|
||||
|
||||
Debug.Log("Steam Init 状态: " + steamInitialized);
|
||||
|
||||
if (!steamInitialized)
|
||||
{
|
||||
SetFailText("Steam 初始化失败");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log("Steam LoggedOn: " + SteamUser.BLoggedOn());
|
||||
|
||||
SetWelcomeText();
|
||||
}
|
||||
|
||||
@@ -36,24 +49,33 @@ public class steamCheck : MonoBehaviour
|
||||
if (welcomeText == null)
|
||||
return;
|
||||
|
||||
if (!SteamUser.BLoggedOn())
|
||||
if (!steamInitialized)
|
||||
{
|
||||
SetFailText("Steam 未初始化");
|
||||
return;
|
||||
}
|
||||
|
||||
string playerName = SteamFriends.GetPersonaName();
|
||||
CSteamID steamID = SteamUser.GetSteamID();
|
||||
|
||||
welcomeText.text = $"欢迎,专员测试1用户 {playerName} ({steamID.m_SteamID})";
|
||||
welcomeText.text = $"欢迎特别测试专员 {playerName} ({steamID.m_SteamID})";
|
||||
}
|
||||
|
||||
void SetFailText(string msg)
|
||||
{
|
||||
if (welcomeText != null)
|
||||
welcomeText.text = msg;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (SteamAPI.IsSteamRunning())
|
||||
if (steamInitialized)
|
||||
SteamAPI.RunCallbacks();
|
||||
}
|
||||
|
||||
void OnApplicationQuit()
|
||||
{
|
||||
if (SteamAPI.IsSteamRunning())
|
||||
if (steamInitialized)
|
||||
SteamAPI.Shutdown();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user