技能主要更新,修复卡顿并加入动画,以及各种其他更新。
This commit is contained in:
@@ -39,36 +39,45 @@ public class pressStart : MonoBehaviour
|
||||
banflagContent = string.Empty;
|
||||
|
||||
// Ensure status text shows idle
|
||||
UpdateStatus("谱师测试专用:回车Enter进入游戏测试版", Color.green);
|
||||
UpdateStatus("��ʦ����ר�ã��س�Enter������Ϸ����", Color.green);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
private bool check_enterNextScene = false;
|
||||
private static readonly string WARNING_TEXT_CONTENT = "<color=orange>当前处于测试阶段</color><color=red>未授权版本</color><color=orange>版本号:</color><color=red>v1.0.0</color><color=orange>,请注意风险。</color>";
|
||||
|
||||
void Update()
|
||||
{
|
||||
bool check_enterNextScene = false;
|
||||
if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0))
|
||||
// 增加对任何按键或点击的响应,提高 Build 包的兼容性
|
||||
if (Input.anyKeyDown)
|
||||
{
|
||||
if (check_enterNextScene) return;
|
||||
GameConfig.testMode = false;
|
||||
warningText.text = "<color=orange>你正在尝试进入</color><color=red>未完整开发</color><color=orange>版本,点击</color><color=red>y键</color><color=orange>忽略警告进入。</color>";
|
||||
check_enterNextScene = true;
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.Mouse0) && check_enterNextScene)
|
||||
{
|
||||
SceneManager.LoadScene("UI_UI");
|
||||
}
|
||||
// Enter进入测试模式,不加载json,开始轮询banflag
|
||||
if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter))
|
||||
{
|
||||
Debug.Log("Entering test mode");
|
||||
GameConfig.testMode = true;
|
||||
|
||||
// start polling for banflag every 3 seconds
|
||||
if (pollCoroutine != null)
|
||||
// 排除掉专门用于测试模式的 Enter 键
|
||||
if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter))
|
||||
{
|
||||
StopCoroutine(pollCoroutine);
|
||||
Debug.Log("[pressStart] Enter detected, starting test mode polling.");
|
||||
GameConfig.testMode = true;
|
||||
if (pollCoroutine != null) StopCoroutine(pollCoroutine);
|
||||
pollCoroutine = StartCoroutine(PollForBanflagAndProceed());
|
||||
return;
|
||||
}
|
||||
pollCoroutine = StartCoroutine(PollForBanflagAndProceed());
|
||||
|
||||
// 正常流程:点击或空格
|
||||
if (check_enterNextScene)
|
||||
{
|
||||
Debug.Log("[pressStart] Second input detected, loading UI_UI scene. Forcing Time.timeScale = 1.");
|
||||
Time.timeScale = 1f; // Ensure time is running for next scene
|
||||
SceneManager.LoadScene("UI_UI");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log("[pressStart] First input detected, setting check_enterNextScene = true");
|
||||
GameConfig.testMode = false;
|
||||
if (warningText != null)
|
||||
{
|
||||
warningText.gameObject.SetActive(true);
|
||||
warningText.text = WARNING_TEXT_CONTENT;
|
||||
}
|
||||
check_enterNextScene = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +93,11 @@ public class pressStart : MonoBehaviour
|
||||
UpdateStatus("Banflag detected. Loading test mode...", Color.green);
|
||||
// small delay to show status
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
SceneManager.LoadScene(testModeSceneName);
|
||||
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(testModeSceneName);
|
||||
while (!asyncLoad.isDone)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
else
|
||||
@@ -96,6 +109,15 @@ public class pressStart : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator LoadSceneAsync(string sceneName)
|
||||
{
|
||||
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneName);
|
||||
while (!asyncLoad.isDone)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateStatus(string message, Color color)
|
||||
{
|
||||
if (statusText != null)
|
||||
@@ -146,7 +168,7 @@ public class pressStart : MonoBehaviour
|
||||
|
||||
if (string.IsNullOrEmpty(banflag_filePath))
|
||||
{
|
||||
Debug.LogWarning("banflag_filePath 未配置。");
|
||||
Debug.LogWarning("banflag_filePath δ���á�");
|
||||
UpdateStatus("Error: banflag path not configured", Color.red);
|
||||
return false;
|
||||
}
|
||||
@@ -154,7 +176,7 @@ public class pressStart : MonoBehaviour
|
||||
string filePath = Path.Combine(banflag_filePath, "test.banflag");
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
Debug.LogWarning($"未找到对应 banflag 文件: {filePath}");
|
||||
Debug.LogWarning($"δ�ҵ���Ӧ banflag �ļ�: {filePath}");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -164,11 +186,11 @@ public class pressStart : MonoBehaviour
|
||||
byte[] data = File.ReadAllBytes(filePath);
|
||||
if (data == null || data.Length == 0)
|
||||
{
|
||||
Debug.LogWarning($"banflag 文件为空: {filePath}");
|
||||
Debug.LogWarning($"banflag �ļ�Ϊ��: {filePath}");
|
||||
}
|
||||
else
|
||||
{
|
||||
// 以UTF8读取(可能为可序列化文本)
|
||||
// ��UTF8��ȡ������Ϊ�����л��ı���
|
||||
string text = null;
|
||||
try
|
||||
{
|
||||
@@ -182,7 +204,7 @@ public class pressStart : MonoBehaviour
|
||||
bool looksLikeText = false;
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
// 是否包含大量不可打印字符
|
||||
// �Ƿ�����������ɴ�ӡ�ַ�
|
||||
int nonPrintable = 0;
|
||||
int checkLen = Mathf.Min(256, text.Length);
|
||||
for (int i = 0; i < checkLen; i++)
|
||||
@@ -195,20 +217,20 @@ public class pressStart : MonoBehaviour
|
||||
|
||||
if (looksLikeText)
|
||||
{
|
||||
Debug.Log($"找到 banflag 文件: {filePath}\n内容:\n{text}");
|
||||
Debug.Log($"�ҵ� banflag �ļ�: {filePath}\n����:\n{text}");
|
||||
// store the readable content for other scenes
|
||||
banflagContent = text;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 不是可读文本转为base64
|
||||
// ���ǿɶ��ı�תΪbase64
|
||||
string base64 = System.Convert.ToBase64String(data);
|
||||
Debug.Log($"找到 banflag 文件 (二进制): {filePath},长度={data.Length} bytes。Base64 前200 字符供查看:\n{(base64.Length > 200 ? base64.Substring(0,200) + "..." : base64)}");
|
||||
Debug.Log($"�ҵ� banflag �ļ� (������): {filePath}������={data.Length} bytes��Base64 ǰ200 �ַ����鿴:\n{(base64.Length > 200 ? base64.Substring(0,200) + "..." : base64)}");
|
||||
banflagContent = $"[Binary Data] Length: {data.Length} bytes";
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索同目录下指定类型文件
|
||||
// ����ͬĿ¼��ָ�������ļ�
|
||||
string dir = Path.GetDirectoryName(filePath);
|
||||
if (string.IsNullOrEmpty(dir)) dir = banflag_filePath;
|
||||
|
||||
@@ -275,7 +297,7 @@ public class pressStart : MonoBehaviour
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
Debug.LogError($"读取 banflag 文件时出错: {ex}");
|
||||
Debug.LogError($"��ȡ banflag �ļ�ʱ����: {ex}");
|
||||
UpdateStatus("Error reading banflag", Color.red);
|
||||
// ensure flags cleared on error
|
||||
banflag_exists = false;
|
||||
|
||||
Reference in New Issue
Block a user