(client) feat:UI更新 chore:LogUI性能更好,并且修复反复打开Log消失的bug,删除部分非预期的警告
This commit is contained in:
@ -84,7 +84,7 @@ namespace UI
|
||||
}
|
||||
|
||||
// 尝试将新的实体转换为角色类型。
|
||||
Character newCharacter = entity as Character;
|
||||
var newCharacter = entity as Character;
|
||||
if (newCharacter != null)
|
||||
{
|
||||
focusedEntity = newCharacter;
|
||||
@ -151,11 +151,11 @@ namespace UI
|
||||
return;
|
||||
}
|
||||
|
||||
int requiredUIs = focusedEntity.Inventory.Capacity;
|
||||
int currentUIPoolSize = itemUIPool.Count; // 当前对象池中 ItemUI 实例的总数。
|
||||
var requiredUIs = focusedEntity.Inventory.Capacity;
|
||||
var currentUIPoolSize = itemUIPool.Count; // 当前对象池中 ItemUI 实例的总数。
|
||||
|
||||
// 遍历所有必要的物品槽位,复用对象池中的 ItemUI,或在不足时创建新的 ItemUI。
|
||||
for (int i = 0; i < requiredUIs; i++)
|
||||
for (var i = 0; i < requiredUIs; i++)
|
||||
{
|
||||
ItemUI itemUI;
|
||||
if (i < currentUIPoolSize)
|
||||
@ -178,7 +178,7 @@ namespace UI
|
||||
}
|
||||
|
||||
// 如果库存槽位数量减少,禁用对象池中多余的 ItemUI 实例。
|
||||
for (int i = requiredUIs; i < currentUIPoolSize; i++)
|
||||
for (var i = requiredUIs; i < currentUIPoolSize; i++)
|
||||
{
|
||||
if (itemUIPool[i] != null && itemUIPool[i].gameObject != null)
|
||||
{
|
||||
@ -213,9 +213,9 @@ namespace UI
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < itemUIPool.Count; i++)
|
||||
for (var i = 0; i < itemUIPool.Count; i++)
|
||||
{
|
||||
ItemUI itemUI = itemUIPool[i];
|
||||
var itemUI = itemUIPool[i];
|
||||
if (itemUI != null && itemUI.gameObject != null)
|
||||
{
|
||||
// 只有在 ItemUI 激活状态下才设置其选中状态,避免对禁用UI的操作
|
||||
@ -239,12 +239,12 @@ namespace UI
|
||||
return;
|
||||
}
|
||||
|
||||
float scrollInput = Input.GetAxis("Mouse ScrollWheel");
|
||||
var scrollInput = Input.GetAxis("Mouse ScrollWheel");
|
||||
|
||||
if (scrollInput != 0) // 检测到滚轮输入
|
||||
{
|
||||
int currentSelection = focusedEntity.CurrentSelected;
|
||||
int inventoryCapacity = focusedEntity.Inventory.Capacity;
|
||||
var currentSelection = focusedEntity.CurrentSelected;
|
||||
var inventoryCapacity = focusedEntity.Inventory.Capacity;
|
||||
|
||||
if (scrollInput > 0) // 滚轮向上,选择前一个
|
||||
{
|
||||
|
Reference in New Issue
Block a user