UI HUGE UPDATE

This commit is contained in:
FloatGaming
2026-06-25 11:48:56 +08:00
parent bd2a06f4c7
commit b2a1e307a4
1806 changed files with 359863 additions and 20822 deletions
+217
View File
@@ -0,0 +1,217 @@
using UnityEditor;
using UnityEngine;
public static class ItemUsageTagAutoSync
{
[MenuItem("Tools/Bansonic/Sync Item Usage Tags")]
private static void SyncAllItemUsageTags()
{
int changedCount = 0;
changedCount += SyncAssets<storeItemSO>("t:storeItemSO", ApplyStoreItemUsageTag);
changedCount += SyncAssets<expBottlesSO>("t:expBottlesSO", ApplyExpBottleUsageTag);
changedCount += SyncAssets<growthMaterialSO>("t:growthMaterialSO", ApplyGrowthMaterialUsageTag);
changedCount += SyncAssets<equipmentConsumableSO>("t:equipmentConsumableSO", ApplyEquipmentConsumableUsageTag);
changedCount += SyncAssets<notebook_faterType>("t:notebook_faterType", ApplyNotebookUsageTag);
if (changedCount > 0)
{
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
}
Debug.Log($"用途词条同步完成,更新了 {changedCount} 个资源。");
}
private static int SyncAssets<T>(string filter, System.Func<T, bool> apply) where T : Object
{
string[] guids = AssetDatabase.FindAssets(filter);
int changedCount = 0;
for (int i = 0; i < guids.Length; i++)
{
string path = AssetDatabase.GUIDToAssetPath(guids[i]);
T asset = AssetDatabase.LoadAssetAtPath<T>(path);
if (asset == null)
{
continue;
}
if (!apply(asset))
{
continue;
}
EditorUtility.SetDirty(asset);
changedCount++;
}
return changedCount;
}
private static bool ApplyStoreItemUsageTag(storeItemSO item)
{
if (item == null)
{
return false;
}
ItemUsageTag target = ResolveStoreItemUsageTag(item);
if (item.itemUsageTag == target)
{
return false;
}
item.itemUsageTag = target;
return true;
}
private static bool ApplyExpBottleUsageTag(expBottlesSO item)
{
if (item == null || item.usageTag == ItemUsageTag.CharacterCultivation)
{
return false;
}
item.usageTag = ItemUsageTag.CharacterCultivation;
return true;
}
private static bool ApplyGrowthMaterialUsageTag(growthMaterialSO item)
{
if (item == null || item.usageTag == ItemUsageTag.CharacterBreakthrough)
{
return false;
}
item.usageTag = ItemUsageTag.CharacterBreakthrough;
return true;
}
private static bool ApplyEquipmentConsumableUsageTag(equipmentConsumableSO item)
{
if (item == null)
{
return false;
}
ItemUsageTag target;
switch (item.consumableType)
{
case equipmentConsumableSO.EquipmentConsumableType.UpgradeMaterial:
target = ItemUsageTag.EquipmentUpgrade;
break;
case equipmentConsumableSO.EquipmentConsumableType.BreakthroughMaterial:
target = ItemUsageTag.EquipmentIllusion;
break;
case equipmentConsumableSO.EquipmentConsumableType.TransferMaterial:
target = ItemUsageTag.EquipmentTransfer;
break;
case equipmentConsumableSO.EquipmentConsumableType.FinalDreamMaterial:
target = ItemUsageTag.FinalDream;
break;
default:
target = ItemUsageTag.EquipmentMaterial;
break;
}
if (item.usageTag == target)
{
return false;
}
item.usageTag = target;
return true;
}
private static bool ApplyNotebookUsageTag(notebook_faterType item)
{
if (item == null)
{
return false;
}
ItemUsageTag target;
switch (item.fatherType)
{
case notebook_faterType.notebook_fatherType.idols:
target = ItemUsageTag.CharacterClue;
break;
case notebook_faterType.notebook_fatherType.content:
target = ItemUsageTag.StoryClue;
break;
default:
target = ItemUsageTag.PreciousItem;
break;
}
if (item.usageTag == target)
{
return false;
}
item.usageTag = target;
return true;
}
private static ItemUsageTag ResolveStoreItemUsageTag(storeItemSO item)
{
if (item.associatedExpBottle != null)
{
return item.associatedExpBottle.usageTag != ItemUsageTag.Auto
? item.associatedExpBottle.usageTag
: ItemUsageTag.CharacterCultivation;
}
if (item.associatedGrowthMaterial != null)
{
return item.associatedGrowthMaterial.usageTag != ItemUsageTag.Auto
? item.associatedGrowthMaterial.usageTag
: ItemUsageTag.CharacterBreakthrough;
}
if (item.associatedEquipmentConsumable != null)
{
if (item.associatedEquipmentConsumable.usageTag != ItemUsageTag.Auto)
{
return item.associatedEquipmentConsumable.usageTag;
}
switch (item.associatedEquipmentConsumable.consumableType)
{
case equipmentConsumableSO.EquipmentConsumableType.UpgradeMaterial:
return ItemUsageTag.EquipmentUpgrade;
case equipmentConsumableSO.EquipmentConsumableType.BreakthroughMaterial:
return ItemUsageTag.EquipmentIllusion;
case equipmentConsumableSO.EquipmentConsumableType.TransferMaterial:
return ItemUsageTag.EquipmentTransfer;
case equipmentConsumableSO.EquipmentConsumableType.FinalDreamMaterial:
return ItemUsageTag.FinalDream;
default:
return ItemUsageTag.EquipmentMaterial;
}
}
if (item.associatedSelectableEquipmentRewardSource != null)
{
return ItemUsageTag.EquipmentAcquisition;
}
switch (item.itemType)
{
case storeItemSO.ItemType.character:
return ItemUsageTag.CharacterUnlock;
case storeItemSO.ItemType.song:
return ItemUsageTag.SongUnlock;
case storeItemSO.ItemType.storyPassage:
if (item.associatedStoryPassage != null && item.associatedStoryPassage.usageTag != ItemUsageTag.Auto)
{
return item.associatedStoryPassage.usageTag;
}
return ItemUsageTag.StoryClue;
case storeItemSO.ItemType.consumable:
return ItemUsageTag.Consumable;
default:
return ItemUsageTag.Other;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f3fb127c25b34ca41a2dc67a610ab1c7