(client) chore
This commit is contained in:
16
Client/Assets/Scripts/UI/BarUI.cs
Normal file
16
Client/Assets/Scripts/UI/BarUI.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
3
Client/Assets/Scripts/UI/BarUI.cs.meta
Normal file
3
Client/Assets/Scripts/UI/BarUI.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5026699f3a94f029628af90ccd8fa8d
|
||||
timeCreated: 1756183343
|
10
Client/Assets/Scripts/UI/EquipmentUI.cs
Normal file
10
Client/Assets/Scripts/UI/EquipmentUI.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class EquipmentUI:MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject uiParent;
|
||||
|
||||
}
|
||||
}
|
3
Client/Assets/Scripts/UI/EquipmentUI.cs.meta
Normal file
3
Client/Assets/Scripts/UI/EquipmentUI.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4432817f903945648bdc0b3a4ba19adc
|
||||
timeCreated: 1756195128
|
9
Client/Assets/Scripts/UI/ItemUI.cs
Normal file
9
Client/Assets/Scripts/UI/ItemUI.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class ItemUI:MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
}
|
3
Client/Assets/Scripts/UI/ItemUI.cs.meta
Normal file
3
Client/Assets/Scripts/UI/ItemUI.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d651a3517184abcb4aff78629eb7946
|
||||
timeCreated: 1756195181
|
@ -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;
|
||||
}
|
||||
|
21
Client/Assets/Scripts/UI/PlayerStateUI.cs
Normal file
21
Client/Assets/Scripts/UI/PlayerStateUI.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
3
Client/Assets/Scripts/UI/PlayerStateUI.cs.meta
Normal file
3
Client/Assets/Scripts/UI/PlayerStateUI.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2fcb0352f5bd43a49b164e24a38447e3
|
||||
timeCreated: 1756183287
|
@ -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
|
||||
|
Reference in New Issue
Block a user