改动与优化

This commit is contained in:
2026-07-20 22:19:25 +08:00
parent 0a0872c4f4
commit b5d1cdcbc5
83 changed files with 2475 additions and 276 deletions
+18 -4
View File
@@ -32,6 +32,7 @@ public class UI_userBag : MonoBehaviour
[Header("button")]
public Button closeBagButton;
private bool isClosing;
private void Awake()
{
@@ -43,6 +44,7 @@ public class UI_userBag : MonoBehaviour
private void OnEnable()
{
isClosing = false;
InitializeToggleGroup();
BindToggles();
BindCloseButton();
@@ -189,14 +191,21 @@ public class UI_userBag : MonoBehaviour
private void HandleCloseBagClicked()
{
uBag bagRoot = GetComponentInParent<uBag>();
if (bagRoot != null)
if (isClosing)
{
Destroy(bagRoot.gameObject);
return;
}
Destroy(gameObject);
isClosing = true;
uBag bagRoot = GetComponentInParent<uBag>();
GameObject target = bagRoot != null ? bagRoot.gameObject : gameObject;
UI_PanelExitUtility.PlayExitThen(target, () =>
{
if (target != null)
{
Destroy(target);
}
});
}
private void ApplyPanelState(GameObject activeObject)
@@ -221,7 +230,12 @@ public class UI_userBag : MonoBehaviour
return;
}
bool wasActive = target.activeInHierarchy;
target.SetActive(active);
if (active && !wasActive)
{
UI_OrderedEntryAnimator.PlayRefresh(target, 0.14f, -6f, 0.99f, true);
}
}
private void SetToggleInteractable(Toggle toggle, bool interactable)
+15
View File
@@ -534,6 +534,7 @@ public class uBag : MonoBehaviour
}
PositionIntroduction(source, spawnedIntroduction);
UI_OrderedEntryAnimator.PlayFadeOnly(spawnedIntroduction, 0, 0.16f, 0f, true);
}
public void HidePreviewFor(uBagItemPrefab source)
@@ -862,6 +863,7 @@ public class uBag : MonoBehaviour
GameObject instance = Instantiate(itemPrefab, itemParent);
instance.name = $"uBagItem_{entry.stableId}";
spawnedItems.Add(instance);
UI_OrderedEntryAnimator.PlaySingle(instance, spawnedItems.Count - 1, 0.18f, 0.01f, -16f, 0.965f, true);
uBagItemPrefab prefabView = instance.GetComponent<uBagItemPrefab>();
if (prefabView != null)
@@ -973,6 +975,8 @@ public class uBag : MonoBehaviour
{
itemDescription.text = entry.description ?? string.Empty;
}
PlayRightPanelRefresh();
}
private void ClearRightPanel()
@@ -1024,6 +1028,17 @@ public class uBag : MonoBehaviour
{
itemDescription.text = string.Empty;
}
PlayRightPanelRefresh();
}
private void PlayRightPanelRefresh()
{
GameObject target = null;
if (btmImg != null) target = btmImg.gameObject;
if (target == null && itemDprofile != null) target = itemDprofile.gameObject;
if (target == null && itemName != null) target = itemName.gameObject;
UI_OrderedEntryAnimator.PlayRefresh(target, 0.14f, -6f, 0.99f, true);
}
private static int CompareEntries(BagEntry left, BagEntry right)