(client) chore

This commit is contained in:
m0_75251201
2025-08-26 16:00:58 +08:00
parent efbf4f824a
commit f04c89046b
51 changed files with 2390 additions and 617 deletions

View File

@ -0,0 +1,16 @@
using UnityEngine;
using UnityEngine.UI;
namespace UI
{
public class BarUI:MonoBehaviour
{
[SerializeField] private Image image;
public float Progress
{
get => image.fillAmount;
set => image.fillAmount = value;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a5026699f3a94f029628af90ccd8fa8d
timeCreated: 1756183343

View File

@ -0,0 +1,10 @@
using UnityEngine;
namespace UI
{
public class EquipmentUI:MonoBehaviour
{
[SerializeField] private GameObject uiParent;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4432817f903945648bdc0b3a4ba19adc
timeCreated: 1756195128

View File

@ -0,0 +1,9 @@
using UnityEngine;
namespace UI
{
public class ItemUI:MonoBehaviour
{
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7d651a3517184abcb4aff78629eb7946
timeCreated: 1756195181

View File

@ -42,7 +42,7 @@ namespace UI
// 如果日志数量减少,清理多余的条目
if (logs.Count < _lastLogCount)
{
for (int i = logs.Count; i < _lastLogCount; i++)
for (var i = logs.Count; i < _lastLogCount; i++)
{
Destroy(_logItems[i].gameObject);
}
@ -51,7 +51,7 @@ namespace UI
}
// 更新现有条目
for (int i = 0; i < Math.Min(logs.Count, _logItems.Count); i++)
for (var i = 0; i < Math.Min(logs.Count, _logItems.Count); i++)
{
UpdateLogEntry(_logItems[i], logs[logs.Count - 1 - i]);
}
@ -59,7 +59,7 @@ namespace UI
// 添加新的条目
if (logs.Count > _lastLogCount)
{
for (int i = _lastLogCount; i < logs.Count; i++)
for (var i = _lastLogCount; i < logs.Count; i++)
{
CreateLogEntry(logs[logs.Count - 1 - i]);
}
@ -85,7 +85,7 @@ namespace UI
logItem.Label = entry.ToString();
// 设置文本颜色(根据日志类型)
if (logColors.TryGetValue(entry.Type, out Color color))
if (logColors.TryGetValue(entry.Type, out var color))
{
logItem.text.color = color;
}

View File

@ -0,0 +1,21 @@
using TMPro;
using UnityEngine;
namespace UI
{
public class PlayerStateUI:MonoBehaviour,Base.ITick
{
[SerializeField] private BarUI focusedEntityHP;
[SerializeField] private BarUI lastEntityHP;
public void Tick()
{
var focusedEntity = Program.Instance.focusedEntity;
if (focusedEntity)
{
focusedEntityHP.Progress = (float)focusedEntity.attributes.health/focusedEntity.entityDef.attributes.health;
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2fcb0352f5bd43a49b164e24a38447e3
timeCreated: 1756183287

View File

@ -38,7 +38,7 @@ namespace UI
windowResolution.AddOptions(options);
if (currentSettings.windowResolution != null)
{
int resolutionIndex = System.Array.FindIndex(Base.Setting.CommonResolutions, r => r == currentSettings.windowResolution);
var resolutionIndex = System.Array.FindIndex(Base.Setting.CommonResolutions, r => r == currentSettings.windowResolution);
windowResolution.value = resolutionIndex >= 0 ? resolutionIndex : 0;
}
else