技能主要更新,修复卡顿并加入动画,以及各种其他更新。

This commit is contained in:
FloatGaming
2026-02-07 21:05:17 +08:00
parent abeca51be5
commit 1ac3cd0104
1349 changed files with 1526749 additions and 24850 deletions
+10 -10
View File
@@ -2,8 +2,8 @@ using UnityEngine;
public class WebViewPanelFollower : MonoBehaviour
{
public RectTransform panelRect; // 拖拽要跟随的 UI Panel RectTransform
public Camera uiCamera; // UI 相机,通常是 Canvas Event Camera
public RectTransform panelRect; // קҪ UI Panel RectTransform
public Camera uiCamera; // UI ͨ Canvas Event Camera
private Rect lastPanelRect;
private WebViewWin32.RECT lastUnityWindowRect;
@@ -43,17 +43,17 @@ public class WebViewPanelFollower : MonoBehaviour
if (panelRect == null || uiCamera == null || WebViewLauncher.Instance == null)
return;
// 获取当前 panel 的屏幕矩形
// ȡǰ panel Ļ
Rect currentPanelRect = GetPanelScreenRect(panelRect);
// 获取当前 Unity 窗口位置(仅在 build 中需要)
WebViewWin32.RECT currentUnityWindowRect = new WebViewWin32.RECT();
// ȡǰ Unity λã build Ҫ
#if !UNITY_EDITOR
WebViewWin32.RECT currentUnityWindowRect = new WebViewWin32.RECT();
if (!WebViewWin32.TryGetClientScreenRect(System.Diagnostics.Process.GetCurrentProcess(), out currentUnityWindowRect))
return;
#endif
// 检查是否需要更新
// ǷҪ
if (!hasLastRect ||
!ApproximatelyEqual(currentPanelRect, lastPanelRect)
#if !UNITY_EDITOR
@@ -63,18 +63,18 @@ public class WebViewPanelFollower : MonoBehaviour
{
int x, y;
#if UNITY_EDITOR
// 在编辑器中,直接使用屏幕坐标(相对于屏幕左上角)
// ڱ༭УֱʹĻĻϽǣ
x = Mathf.RoundToInt(currentPanelRect.x);
y = Mathf.RoundToInt(Screen.height - currentPanelRect.y - currentPanelRect.height);
#else
// build 中,使用 Unity 窗口位置 + 相对坐标
// build Уʹ Unity λ +
x = Mathf.RoundToInt(currentUnityWindowRect.Left + currentPanelRect.x);
y = Mathf.RoundToInt(currentUnityWindowRect.Top + (Screen.height - currentPanelRect.y - currentPanelRect.height));
#endif
int w = Mathf.RoundToInt(currentPanelRect.width);
int h = Mathf.RoundToInt(currentPanelRect.height);
// 更新 WebView 窗口
// WebView
bool success = WebViewLauncher.Instance.TryUpdateWebViewRect(x, y, w, h);
if (success)
{
@@ -102,8 +102,8 @@ public class WebViewPanelFollower : MonoBehaviour
Rect currentPanelRect = GetPanelScreenRect(panelRect);
WebViewWin32.RECT currentUnityWindowRect = new WebViewWin32.RECT();
#if !UNITY_EDITOR
WebViewWin32.RECT currentUnityWindowRect = new WebViewWin32.RECT();
if (!WebViewWin32.TryGetClientScreenRect(System.Diagnostics.Process.GetCurrentProcess(), out currentUnityWindowRect))
return;
#endif
@@ -6,7 +6,7 @@ using System.IO;
public class game_card_Prefab : MonoBehaviour, IPointerClickHandler
{
[Header("Prefab基本信息")]
[Header("PrefabϢ")]
public Image card_icon_image;
public Text card_name_text;
public Text authorName_text;
@@ -19,10 +19,10 @@ public class game_card_Prefab : MonoBehaviour, IPointerClickHandler
[Header("Optional clickable Button (auto-find if null)")]
public Button clickButton;
// 存储对应 index.html 的本地路径(不含 file:// 前缀)
// Ӧ index.html ı· file:// ǰ׺
private string indexFilePath;
// loadLittleGamesPrefab 调用以填充文本和路径
// loadLittleGamesPrefab ı·
public void SetData(string indexPath, string cardName, string authorName, string description, string isOfficial, string source, string yyyyMmDd, string version = null)
{
indexFilePath = indexPath;
@@ -96,7 +96,7 @@ public class game_card_Prefab : MonoBehaviour, IPointerClickHandler
OpenIndexPath();
}
// 点击时尝试通过 WebViewLauncher 打开对应的 index.html
// ʱͨ WebViewLauncher 򿪶Ӧ index.html
public void OnPointerClick(PointerEventData eventData)
{
UnityEngine.Debug.Log($"game_card_Prefab.OnPointerClick: indexPath='{indexFilePath}'");
@@ -111,7 +111,7 @@ public class game_card_Prefab : MonoBehaviour, IPointerClickHandler
return;
}
// 优先使用 WebViewLauncher 单例
// ʹ WebViewLauncher
if (WebViewLauncher.Instance != null)
{
UnityEngine.Debug.Log("Calling WebViewLauncher.OpenUrl with: " + indexFilePath);
@@ -135,8 +135,8 @@ public class game_card_Prefab : MonoBehaviour, IPointerClickHandler
else
{
UnityEngine.Debug.LogWarning("WebViewLauncher instance not found. Attempting to start new launcher.");
// 尝试查找场景中的 WebViewLauncher 或创建一个新的 GameObject
var launcherObj = GameObject.FindObjectOfType<WebViewLauncher>();
// Բҳе WebViewLauncher 򴴽һµ GameObject
var launcherObj = UnityEngine.Object.FindAnyObjectByType<WebViewLauncher>();
if (launcherObj != null)
{
UnityEngine.Debug.Log("Found launcher in scene, calling OpenUrl: " + indexFilePath);
@@ -14,11 +14,11 @@ public class loadLittleGamesPrefab : MonoBehaviour
[Header("Prefab")]
public GameObject littleGames_card_Prefab;
[Tooltip("默认icon")]
[Tooltip("Ĭiconͼ")]
public Sprite default_card_icon_sprite;
[Header("Refresh")]
public Button refreshButton; // 点击触发重新扫描并刷新左侧列表
public Button refreshButton; // ɨ貢ˢб
[Header("H5 Root Path (optional, leave empty to use WebViewLauncher settings)")]
public string h5RootPath;
@@ -108,11 +108,11 @@ public class loadLittleGamesPrefab : MonoBehaviour
continue;
// defaults
string defName = "未知Html文件";
string defAuthor = "未知作者";
string defDesc = "暂无相关描述信息";
string defIsOfficial = "未知来源";
string defSource = "自定义渠道";
string defName = "δ֪Htmlļ";
string defAuthor = "δ֪";
string defDesc = "Ϣ";
string defIsOfficial = "δ֪Դ";
string defSource = "Զ";
string defDateRaw = "19700101";
string cardName = GetMeta(meta, "card_name") ?? defName;
@@ -128,12 +128,12 @@ public class loadLittleGamesPrefab : MonoBehaviour
if (cat == "_officialDocs" || cat == "_officialGames")
{
isOfficial = "官方";
source = "小游戏DLC";
isOfficial = "ٷ";
source = "СϷDLC";
}
else
{
if (string.IsNullOrEmpty(isOfficial)) isOfficial = "第三方来源";
if (string.IsNullOrEmpty(isOfficial)) isOfficial = "Դ";
if (string.IsNullOrEmpty(source)) source = defSource;
}
@@ -207,7 +207,7 @@ public class loadLittleGamesPrefab : MonoBehaviour
if (!string.IsNullOrEmpty(h5RootPath) && Directory.Exists(h5RootPath))
return h5RootPath;
var launcher = GameObject.FindObjectOfType<WebViewLauncher>();
var launcher = Object.FindAnyObjectByType<WebViewLauncher>();
if (launcher != null)
{
#if UNITY_EDITOR