ui基本完毕,修了一大把的bug

This commit is contained in:
FloatGaming
2026-07-13 02:28:39 +08:00
parent 1e20d73e90
commit fd22501f71
958 changed files with 378289 additions and 41038 deletions
+6 -4
View File
@@ -23,6 +23,8 @@ public class UI_Idols : MonoBehaviour
[Header("colors")]
public Color[] idolSliderColors;
public Color statIncreaseColor = new Color32(0x7C, 0xFF, 0x6B, 0xFF);
public Color statDecreaseColor = new Color32(0xFF, 0x5A, 0x5A, 0xFF);
[Header("paths")]
public string idolSOpath_runtime;
@@ -986,7 +988,7 @@ public class UI_Idols : MonoBehaviour
return Mathf.RoundToInt(value * 100f) + "%";
}
private static string FormatGrowthInt(int baseValue, int effectiveValue)
private string FormatGrowthInt(int baseValue, int effectiveValue)
{
int growth = effectiveValue - baseValue;
if (growth == 0)
@@ -995,11 +997,11 @@ public class UI_Idols : MonoBehaviour
}
string sign = growth > 0 ? "+" : "-";
string color = growth > 0 ? "#7CFF6B" : "#FF5A5A";
string color = "#" + ColorUtility.ToHtmlStringRGB(growth > 0 ? statIncreaseColor : statDecreaseColor);
return $"{baseValue} <color={color}>{sign} {Mathf.Abs(growth)}</color>";
}
private static string FormatGrowthPercent(float baseValue, float effectiveValue)
private string FormatGrowthPercent(float baseValue, float effectiveValue)
{
float growth = effectiveValue - baseValue;
string baseText = FormatPercent(baseValue);
@@ -1009,7 +1011,7 @@ public class UI_Idols : MonoBehaviour
}
string sign = growth > 0f ? "+" : "-";
string color = growth > 0f ? "#7CFF6B" : "#FF5A5A";
string color = "#" + ColorUtility.ToHtmlStringRGB(growth > 0f ? statIncreaseColor : statDecreaseColor);
return $"{baseText} <color={color}>{sign} {FormatPercent(Mathf.Abs(growth))}</color>";
}
+10 -1
View File
@@ -91,6 +91,7 @@ public class deSkillPrefab : MonoBehaviour, IPointerEnterHandler, IPointerExitHa
string displayName,
string detailName,
string detailDescription,
Sprite bottomSprite,
Color bottomColor,
Material iconMaterial,
bool enableToggleValue,
@@ -114,7 +115,15 @@ public class deSkillPrefab : MonoBehaviour, IPointerEnterHandler, IPointerExitHa
if (skillIcon_btm != null)
{
skillIcon_btm.color = bottomColor;
if (bottomSprite != null)
{
skillIcon_btm.sprite = bottomSprite;
skillIcon_btm.color = Color.white;
}
else
{
skillIcon_btm.color = bottomColor;
}
}
if (skillName != null)
+7 -7
View File
@@ -617,7 +617,7 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: bd4be44636ad6c24a9b117a7108a75e9, type: 3}
m_Font: {fileID: 12800000, guid: d254d20d93651ae448ff13d10dff30ab, type: 3}
m_FontSize: 16
m_FontStyle: 0
m_BestFit: 0
@@ -879,14 +879,14 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0.58643895, b: 0.48584908, a: 1}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Sprite: {fileID: 21300000, guid: 5ce43da28e0e4464a8a3bd79cfdd18de, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -1168,7 +1168,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 7f3b1220317607e44bbb8f0e1998044a, type: 3}
m_Sprite: {fileID: 21300000, guid: 3313ab17f45abdb48a37863e4b5a1960, type: 3}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
@@ -1292,7 +1292,7 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: bd4be44636ad6c24a9b117a7108a75e9, type: 3}
m_Font: {fileID: 12800000, guid: d254d20d93651ae448ff13d10dff30ab, type: 3}
m_FontSize: 16
m_FontStyle: 0
m_BestFit: 0
@@ -1455,7 +1455,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_SizeDelta: {x: 95, y: 95}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &921758039027008102
CanvasRenderer:
@@ -1722,7 +1722,7 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: bd4be44636ad6c24a9b117a7108a75e9, type: 3}
m_Font: {fileID: 12800000, guid: d254d20d93651ae448ff13d10dff30ab, type: 3}
m_FontSize: 18
m_FontStyle: 0
m_BestFit: 0
+119 -29
View File
@@ -224,7 +224,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -15.15, y: 5.7}
m_AnchoredPosition: {x: -39.73, y: 5.7}
m_SizeDelta: {x: 195.474, y: 34.7}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5188508050413583474
@@ -342,8 +342,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -4.7900314, y: 0}
m_SizeDelta: {x: 160, y: 27.567}
m_AnchoredPosition: {x: -5.91, y: 0}
m_SizeDelta: {x: 180.9946, y: 27.567}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &5279635220217783635
MonoBehaviour:
@@ -392,7 +392,7 @@ MonoBehaviour:
m_MinValue: 0
m_MaxValue: 1
m_WholeNumbers: 0
m_Value: 0.5
m_Value: 0
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
@@ -432,8 +432,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -0.032, y: 0.167}
m_SizeDelta: {x: 305.899, y: 89.835}
m_AnchoredPosition: {x: 2.0305, y: -0.2197}
m_SizeDelta: {x: 301.774, y: 89.0616}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6392068697533144310
CanvasRenderer:
@@ -456,7 +456,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Color: {r: 1, g: 1, b: 1, a: 0.003921569}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@@ -486,6 +486,81 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_ShowMaskGraphic: 1
--- !u!1 &2879224782309459683
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2046257290644327508}
- component: {fileID: 31369553118811393}
- component: {fileID: 909166866769884569}
m_Layer: 5
m_Name: mask
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2046257290644327508
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2879224782309459683}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1620780516862672182}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &31369553118811393
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2879224782309459683}
m_CullTransparentMesh: 1
--- !u!114 &909166866769884569
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2879224782309459683}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: -9008400303772181359, guid: 144cc3f73b187da42af804a6b4c0fc0f, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &5434632579727429882
GameObject:
m_ObjectHideFlags: 0
@@ -520,7 +595,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.00001986, y: 22.8}
m_AnchoredPosition: {x: 0.7, y: 22.8}
m_SizeDelta: {x: 195.474, y: 17.35}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8216121053160584427
@@ -552,8 +627,8 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: bd4be44636ad6c24a9b117a7108a75e9, type: 3}
m_FontSize: 14
m_Font: {fileID: 12800000, guid: bc54bd51ea8b84448ba1b65311872862, type: 3}
m_FontSize: 16
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
@@ -600,7 +675,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -22.117, y: -39.1}
m_SizeDelta: {x: 151.241, y: 16.457}
m_SizeDelta: {x: 151.241, y: 22.83}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5340973196074266887
CanvasRenderer:
@@ -632,7 +707,7 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 8b8373b0af11dca46b89be60dbe469f8, type: 3}
m_FontSize: 10
m_FontSize: 15
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
@@ -678,8 +753,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_AnchoredPosition: {x: 0, y: -2.9275}
m_SizeDelta: {x: 89.8043, y: 89.8046}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5460090346994670938
CanvasRenderer:
@@ -709,7 +784,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: a2753bc864b1ff84093beb30d9d04892, type: 3}
m_Sprite: {fileID: 21300000, guid: eec334d03c52af847bfa12dc839ac536, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -943,6 +1018,7 @@ GameObject:
- component: {fileID: 1620780516862672182}
- component: {fileID: 6966275103615714450}
- component: {fileID: 6479233415005981424}
- component: {fileID: 6946207524742656500}
m_Layer: 5
m_Name: profileIcon
m_TagString: Untagged
@@ -962,13 +1038,14 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2046257290644327508}
- {fileID: 1363084329767464734}
m_Father: {fileID: 4121223171157752982}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -143.83, y: 0}
m_SizeDelta: {x: 105.57, y: 93.724}
m_AnchoredPosition: {x: -158.1, y: 0}
m_SizeDelta: {x: 100.5978, y: 89.1227}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6966275103615714450
CanvasRenderer:
@@ -991,14 +1068,14 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Color: {r: 1, g: 1, b: 1, a: 0.003921569}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 3c8d36a264ea7b247bfce0504d1b70a5, type: 3}
m_Sprite: {fileID: 21300000, guid: 123efed06f92ffd4c964148182b5913b, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -1008,6 +1085,19 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &6946207524742656500
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6789492522696529063}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ShowMaskGraphic: 1
--- !u!1 &7236883710045013553
GameObject:
m_ObjectHideFlags: 0
@@ -1119,8 +1209,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -34.41, y: -16.1}
m_SizeDelta: {x: 154.123, y: 15}
m_AnchoredPosition: {x: -48.8953, y: -16.1}
m_SizeDelta: {x: 176.3526, y: 15}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8145498667973837225
CanvasRenderer:
@@ -1209,8 +1299,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 97.031, y: 86.144}
m_AnchoredPosition: {x: -0.000042558, y: 0.000028372}
m_SizeDelta: {x: 89.3202, y: 79.1317}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3418190289911847269
CanvasRenderer:
@@ -1233,7 +1323,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Color: {r: 1, g: 1, b: 1, a: 0.003921569}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@@ -1331,7 +1421,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: ccc4adb33b5acd7478c8fd05b5438550, type: 3}
m_Sprite: {fileID: 21300000, guid: 01a751e0f980cc9449c1705453525a5c, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -1406,7 +1496,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: ccc4adb33b5acd7478c8fd05b5438550, type: 3}
m_Sprite: {fileID: 21300000, guid: 01a751e0f980cc9449c1705453525a5c, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -1525,8 +1615,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 80.3, y: 1}
m_SizeDelta: {x: 200, y: 200}
m_AnchoredPosition: {x: 77.5, y: -3}
m_SizeDelta: {x: 219.179, y: 219.179}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7691458527157468705
CanvasRenderer:
@@ -1556,7 +1646,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: ad076cf7fd05ad543bffae7ade0cb30a, type: 3}
m_Sprite: {fileID: 21300000, guid: ff35723d3ee455d48908402cf635b6f9, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
+5
View File
@@ -17,6 +17,9 @@ public class idolSkillsHub : MonoBehaviour
[Header("displaying")]
public Material disgot_grayMtr;
public Sprite enabled_btmSprite;
public Sprite disabled_btmSprite;
public Sprite unlock_btmSprite;
public Color enabled_btmColor = Color.white;
public Color disabled_btmColor = Color.white;
public Color unlock_btmColor = Color.gray;
@@ -99,6 +102,7 @@ public class idolSkillsHub : MonoBehaviour
string displayName = hideLockedIdentity ? "\u672a\u89e3\u9501\u6280\u80fd" : (group.groupName ?? string.Empty);
string detailName = displayName;
string detailDescription = hideLockedIdentity ? "\u6b64\u6280\u80fd\u5c1a\u672a\u89e3\u9501\u3002" : (group.skillDescriptionsText ?? string.Empty);
Sprite bottomSprite = equipped ? enabled_btmSprite : (unlocked ? disabled_btmSprite : unlock_btmSprite);
Color bottomColor = equipped ? enabled_btmColor : (unlocked ? disabled_btmColor : unlock_btmColor);
Material iconMaterial = unlocked ? null : disgot_grayMtr;
@@ -119,6 +123,7 @@ public class idolSkillsHub : MonoBehaviour
displayName,
detailName,
detailDescription,
bottomSprite,
bottomColor,
iconMaterial,
enableToggleValue,
+110 -6
View File
@@ -49,10 +49,12 @@ public class idolUpgrade : MonoBehaviour
public Text upgradeText;
private readonly List<materialPrefab> spawnedMaterials = new List<materialPrefab>();
private readonly Dictionary<materialPrefab, expBottlesSO> spawnedBottleBindings = new Dictionary<materialPrefab, expBottlesSO>();
private expBottlesSO selectedBottle;
private DushMaterialKind? selectedBreakthroughMaterialKind;
private bool isShowingBreakthrough;
private string lastOperationSuccessMessage;
private storeItemSO[] cachedStoreItems;
private static readonly Color UpgradeWarningColor = new Color32(120, 36, 36, 255);
private static readonly Color UpgradeMaxColor = new Color32(205, 170, 64, 255);
@@ -220,7 +222,7 @@ public class idolUpgrade : MonoBehaviour
return;
}
string bottleName = selectedBottle.expBottleName;
string bottleName = GetDisplayName(selectedBottle);
string failure;
int consumedCount;
int grantedExp;
@@ -263,11 +265,13 @@ public class idolUpgrade : MonoBehaviour
item.Bind(
bottle.expBottleSprite,
bottle.expBottleName,
GetDisplayName(bottle),
Mathf.Max(0, ExpBottleLedger.EnsureInstance().GetCount(bottle.bottleKind)).ToString(),
bottle.itemRarity,
bottle == selectedBottle,
true,
() => SelectBottle(bottle));
spawnedBottleBindings[item] = bottle;
}
return true;
@@ -337,9 +341,12 @@ public class idolUpgrade : MonoBehaviour
? (requirement.bottle != null ? requirement.bottle.expBottleSprite : null)
: (requirement.material != null ? requirement.material.growthMaterialSprite : null),
requirement.isBottleRequirement
? (requirement.bottle != null ? requirement.bottle.expBottleName : requirement.bottleKind.ToString())
: (requirement.material != null ? requirement.material.growthMaterialName : requirement.materialKind.ToString()),
? GetDisplayName(requirement.bottle, requirement.bottleKind)
: GetDisplayName(requirement.material, requirement.materialKind),
amountText,
requirement.isBottleRequirement
? (requirement.bottle != null ? requirement.bottle.itemRarity : ItemRarity.None)
: (requirement.material != null ? requirement.material.itemRarity : ItemRarity.None),
ShouldHighlightBreakthroughRequirement(requirement, requiresFullSubmission, bundledSelection),
!requiresFullSubmission,
() => SelectBreakthroughMaterial(requirement.materialKind));
@@ -356,7 +363,7 @@ public class idolUpgrade : MonoBehaviour
return;
}
SetInfoText(selectedBottle.expBottleName);
SetInfoText(GetDisplayName(selectedBottle));
SetConfirmInteractable(true);
SetConfirmButtonText("使用");
}
@@ -372,7 +379,10 @@ public class idolUpgrade : MonoBehaviour
continue;
}
bool isSelected = bottle != null && item.materialName != null && item.materialName.text == bottle.expBottleName;
expBottlesSO boundBottle;
bool isSelected = bottle != null
&& spawnedBottleBindings.TryGetValue(item, out boundBottle)
&& boundBottle == bottle;
item.SetSelected(isSelected);
}
@@ -1202,6 +1212,100 @@ public class idolUpgrade : MonoBehaviour
}
spawnedMaterials.Clear();
spawnedBottleBindings.Clear();
}
private string GetDisplayName(expBottlesSO bottle)
{
return GetDisplayName(bottle, bottle != null ? bottle.bottleKind : default);
}
private string GetDisplayName(expBottlesSO bottle, ExpBottleKind fallbackKind)
{
if (bottle != null)
{
storeItemSO storeItem = FindStoreItemForBottle(bottle);
if (storeItem != null && !string.IsNullOrWhiteSpace(storeItem.itemName))
{
return storeItem.itemName.Trim();
}
if (!string.IsNullOrWhiteSpace(bottle.expBottleName))
{
return bottle.expBottleName.Trim();
}
}
return fallbackKind.ToString().Trim();
}
private string GetDisplayName(growthMaterialSO material, DushMaterialKind fallbackKind)
{
if (material != null)
{
storeItemSO storeItem = FindStoreItemForGrowthMaterial(material);
if (storeItem != null && !string.IsNullOrWhiteSpace(storeItem.itemName))
{
return storeItem.itemName.Trim();
}
if (!string.IsNullOrWhiteSpace(material.growthMaterialName))
{
return material.growthMaterialName.Trim();
}
}
return fallbackKind.ToString().Trim();
}
private storeItemSO FindStoreItemForBottle(expBottlesSO bottle)
{
if (bottle == null)
{
return null;
}
storeItemSO[] storeItems = GetStoreItems();
for (int i = 0; i < storeItems.Length; i++)
{
storeItemSO storeItem = storeItems[i];
if (storeItem != null && storeItem.associatedExpBottle == bottle)
{
return storeItem;
}
}
return null;
}
private storeItemSO FindStoreItemForGrowthMaterial(growthMaterialSO material)
{
if (material == null)
{
return null;
}
storeItemSO[] storeItems = GetStoreItems();
for (int i = 0; i < storeItems.Length; i++)
{
storeItemSO storeItem = storeItems[i];
if (storeItem != null && storeItem.associatedGrowthMaterial == material)
{
return storeItem;
}
}
return null;
}
private storeItemSO[] GetStoreItems()
{
if (cachedStoreItems == null)
{
cachedStoreItems = RuntimeResourcesCache.LoadAllStoreItems() ?? Array.Empty<storeItemSO>();
}
return cachedStoreItems;
}
private void SetInfoText(string content)
+51 -3
View File
@@ -7,6 +7,8 @@ public class materialPrefab : MonoBehaviour
{
[Header("imgs")]
public Image boarder;
public Image qualityBorder;
public Sprite[] qualityBorderSprites;
public Image materialImg;
public Button materialButton;
public TextMeshProUGUI materialAmount;
@@ -23,7 +25,7 @@ public class materialPrefab : MonoBehaviour
}
}
public void Bind(Sprite sprite, string displayName, string amountText, bool selected, bool interactable, Action onClick)
public void Bind(Sprite sprite, string displayName, string amountText, ItemRarity rarity, bool selected, bool interactable, Action onClick)
{
clickAction = onClick;
@@ -43,6 +45,7 @@ public class materialPrefab : MonoBehaviour
materialAmount.text = amountText ?? string.Empty;
}
ApplyQualityBorder(rarity);
SetSelected(selected);
if (materialButton != null)
@@ -51,13 +54,23 @@ public class materialPrefab : MonoBehaviour
}
}
public void BindOwnedRequired(Sprite sprite, string displayName, int ownedAmount, int requiredAmount, bool selected, bool interactable, Action onClick)
public void Bind(Sprite sprite, string displayName, string amountText, bool selected, bool interactable, Action onClick)
{
Bind(sprite, displayName, amountText, ItemRarity.None, selected, interactable, onClick);
}
public void BindOwnedRequired(Sprite sprite, string displayName, int ownedAmount, int requiredAmount, ItemRarity rarity, bool selected, bool interactable, Action onClick)
{
string ownedText = ownedAmount < requiredAmount
? $"<color=#FF4D4D>{Mathf.Max(0, ownedAmount)}</color>"
: Mathf.Max(0, ownedAmount).ToString();
string amountText = $"{ownedText}/{Mathf.Max(0, requiredAmount)}";
Bind(sprite, displayName, amountText, selected, interactable, onClick);
Bind(sprite, displayName, amountText, rarity, selected, interactable, onClick);
}
public void BindOwnedRequired(Sprite sprite, string displayName, int ownedAmount, int requiredAmount, bool selected, bool interactable, Action onClick)
{
BindOwnedRequired(sprite, displayName, ownedAmount, requiredAmount, ItemRarity.None, selected, interactable, onClick);
}
public void SetSelected(bool selected)
@@ -68,6 +81,41 @@ public class materialPrefab : MonoBehaviour
}
}
private void ApplyQualityBorder(ItemRarity rarity)
{
if (qualityBorder == null)
{
return;
}
Sprite sprite = ResolveQualityBorderSprite(rarity);
qualityBorder.sprite = sprite;
qualityBorder.enabled = sprite != null;
}
private Sprite ResolveQualityBorderSprite(ItemRarity rarity)
{
if (qualityBorderSprites != null && qualityBorderSprites.Length > 0)
{
int enumIndex = (int)rarity;
if (enumIndex >= 0 && enumIndex < qualityBorderSprites.Length)
{
Sprite sprite = qualityBorderSprites[enumIndex];
if (sprite != null)
{
return sprite;
}
}
if (qualityBorderSprites[0] != null)
{
return qualityBorderSprites[0];
}
}
return null;
}
private void HandleClick()
{
if (materialButton != null && !materialButton.interactable)
@@ -34,8 +34,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -49.994003}
m_SizeDelta: {x: 0, y: -59.836}
m_AnchoredPosition: {x: 0.25, y: -53.308105}
m_SizeDelta: {x: 10, y: -62.3838}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7708545175036600530
CanvasRenderer:
@@ -66,11 +66,11 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: bd4be44636ad6c24a9b117a7108a75e9, type: 3}
m_FontSize: 12
m_Font: {fileID: 12800000, guid: d254d20d93651ae448ff13d10dff30ab, type: 3}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 1
m_MinSize: 1
m_MinSize: 8
m_MaxSize: 16
m_Alignment: 4
m_AlignByGeometry: 0
@@ -142,6 +142,16 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
boarder: {fileID: 4301219412316587214}
qualityBorder: {fileID: 1657374318142278237}
qualityBorderSprites:
- {fileID: 21300000, guid: c1d3013bdbb080f4f8806bc4d6c58db2, type: 3}
- {fileID: 21300000, guid: 0edbf3fabc7d78e43b1c48516f08667a, type: 3}
- {fileID: 21300000, guid: d878370cc5eb0cb409882bb8e6fd7537, type: 3}
- {fileID: 21300000, guid: 3ce075becece84045b16ac2fe217f415, type: 3}
- {fileID: 21300000, guid: 0eab00cf603f6694c89603352de122e6, type: 3}
- {fileID: 21300000, guid: 5ce43da28e0e4464a8a3bd79cfdd18de, type: 3}
- {fileID: 21300000, guid: 01f1bbba4db2f5042b08ca58ec475d34, type: 3}
- {fileID: 21300000, guid: 3c5a917f2e9787643a2bfc1c8f394784, type: 3}
materialImg: {fileID: 6433794917799223522}
materialButton: {fileID: 6223024646424990969}
materialAmount: {fileID: 1761526427795409056}
@@ -330,8 +340,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 80, y: 80}
m_AnchoredPosition: {x: 0.25, y: 0}
m_SizeDelta: {x: 90, y: 90}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &334864567550305053
CanvasRenderer:
@@ -361,7 +371,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 9ebd9ce7600225b48a92c3900b8188fc, type: 3}
m_Sprite: {fileID: 21300000, guid: c123f863b7b5604489f0ddc316ae874c, type: 3}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
@@ -574,8 +584,8 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 7f3b1220317607e44bbb8f0e1998044a, type: 3}
m_Type: 1
m_Sprite: {fileID: 21300000, guid: 0eab00cf603f6694c89603352de122e6, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
+3 -3
View File
@@ -52,7 +52,7 @@ TextureImporter:
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteBorder: {x: 30, y: 2, z: 30, w: 2}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
@@ -121,7 +121,7 @@ TextureImporter:
width: 403
height: 83
alignment: 0
pivot: {x: 0, y: 0}
pivot: {x: 0.5, y: 0.5}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
@@ -139,7 +139,7 @@ TextureImporter:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
internalID: 1537655665
vertices: []
indices:
edges: []