功能批量实现 优化 服务端 新浮动小游戏框架 新界面UI

This commit is contained in:
FloatGaming
2026-04-24 13:20:16 +08:00
parent e0bc0bbf08
commit 5eec879582
257 changed files with 38481 additions and 1288 deletions
+26 -36
View File
@@ -1,55 +1,56 @@
using UnityEngine;
using UnityEngine.UI;
#if !DISABLESTEAMWORKS
using Steamworks;
#endif
public class steamCheck : MonoBehaviour
{
[Header("UI")]
public Text welcomeText;
private const uint APP_ID = 2191270;
private bool steamInitialized = false;
private bool steamReady;
void Awake()
{
#if !UNITY_EDITOR
if (SteamAPI.RestartAppIfNecessary(new AppId_t(APP_ID)))
{
Application.Quit();
return;
}
#endif
RefreshSteamState();
}
try
{
steamInitialized = SteamAPI.Init();
}
catch (System.Exception e)
{
Debug.LogError("Steam 初始化异常: " + e);
steamInitialized = false;
}
void OnEnable()
{
RefreshSteamState();
}
Debug.Log("Steam Init 状态: " + steamInitialized);
void RefreshSteamState()
{
#if DISABLESTEAMWORKS
steamReady = false;
SetFailText("当前平台未启用 Steamworks");
return;
#else
steamReady = SteamManager.Initialized;
Debug.Log("Steam Init 状态: " + steamReady);
if (!steamInitialized)
if (!steamReady)
{
SetFailText("Steam 初始化失败");
return;
}
Debug.Log("Steam LoggedOn: " + SteamUser.BLoggedOn());
SetWelcomeText();
#endif
}
void SetWelcomeText()
{
#if DISABLESTEAMWORKS
SetFailText("当前平台未启用 Steamworks");
#else
if (welcomeText == null)
return;
if (!steamInitialized)
if (!steamReady)
{
SetFailText("Steam 未初始化");
return;
@@ -59,6 +60,7 @@ public class steamCheck : MonoBehaviour
CSteamID steamID = SteamUser.GetSteamID();
welcomeText.text = $"欢迎特别测试专员 {playerName} ({steamID.m_SteamID})";
#endif
}
void SetFailText(string msg)
@@ -66,16 +68,4 @@ public class steamCheck : MonoBehaviour
if (welcomeText != null)
welcomeText.text = msg;
}
void Update()
{
if (steamInitialized)
SteamAPI.RunCallbacks();
}
void OnApplicationQuit()
{
if (steamInitialized)
SteamAPI.Shutdown();
}
}
}