This commit is contained in:
MuHua-123
2025-07-19 17:50:04 +08:00
parent d4574f4bd7
commit 2b349081e2
24 changed files with 1247 additions and 204 deletions
+36
View File
@@ -0,0 +1,36 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using MuHua;
using System;
using System.Text.RegularExpressions;
public class Test : ModuleUIPage {
private string skill;
public override VisualElement Element => root;
public Label label => Q<Label>();
private void Awake() {
string goblin = Settings("哥布林射手", Color.red);
string skill = Settings("短弓射击(23)", Color.yellow);
string elvira = Settings("艾薇拉(12)", Color.green);
string damage = Settings("5穿刺伤害", Color.red);
label.text = $"{goblin}使用{skill}对{elvira}造成了{damage}";
label.RegisterCallback<MouseMoveEvent>(OnMouseMove);
this.skill = Regex.Replace(goblin, "<.*?>", "");
}
private void OnMouseMove(MouseMoveEvent evt) {
Vector2 localPosition = evt.localMousePosition;
if (label.EnterString(skill, localPosition)) { Debug.Log($"鼠标位 {skill} 上"); }
}
private string Settings(string value, Color color) {
value = UITool.RichTextUnderline(value);
return UITool.RichTextColor(value, color);
}
}