This commit is contained in:
2026-07-09 17:21:18 +08:00
parent 7dd688a2f4
commit 174d033998
4 changed files with 43 additions and 20 deletions
@@ -105,15 +105,14 @@ public class RankLineItem : MonoBehaviour
foreach (var gift in giftItems)
{
string imageUrl = gift.product?.imageUrl;
int propType = gift.product?.type ?? 0;
int count = gift.isRandom ? gift.minCount : gift.count;
// product 为空时,用 otherId 查道具表
if (string.IsNullOrEmpty(imageUrl) && !string.IsNullOrEmpty(gift.otherId))
// GiftConfig 已移除 product,道具图标与类型通过 otherId 查道具表
string imageUrl = "";
int propType = 0;
if (!string.IsNullOrEmpty(gift.otherId))
{
var propConfig = GameManager.Instance?.gameConfig?.propConfig;
var match = propConfig?.Find(p => p.number == gift.otherId);
var match = GameManager.Instance?.gameConfig?.propConfig?.Find(p => p.number == gift.otherId);
if (match != null)
{
imageUrl = match.imageUrl;
@@ -5307,7 +5307,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6624374362400250868}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
@@ -85,17 +85,17 @@ public class UIHome_BY_ServicePanel : SubUIBase
{
if (msg.senderType == 1)
{
// 用户消息
var green = Instantiate(dialogGreenPrefab, dialogPrefabParent);
green.showAvatar = true;
green.SetMessage(msg.content);
if (green.waitMessage != null) green.waitMessage.SetActive(false);
}
else
{
// 客服消息
var orange = Instantiate(dialogOrangePrefab, dialogPrefabParent);
orange.showAvatar = false;
orange.SetMessage(msg.content);
if (orange.waitMessage != null) orange.waitMessage.SetActive(false);
}
}
+35 -11
View File
@@ -179,9 +179,9 @@ public class ZhanLing_Panel : SubUIBase
if (sz != null && _userData.isSupreme) giftType |= LevelGiftType.ZhiZun;
item.Init(
nf?.product?.imageUrl ?? "", nf?.count ?? 0,
lx?.product?.imageUrl ?? "", lx?.count ?? 0,
sz?.product?.imageUrl ?? "", sz?.count ?? 0,
ResolveGiftImageUrl(nf), nf?.count ?? 0,
ResolveGiftImageUrl(lx), lx?.count ?? 0,
ResolveGiftImageUrl(sz), sz?.count ?? 0,
lv.level, giftType, isClaimed,
nf?.type ?? 0, lx?.type ?? 0, sz?.type ?? 0);
}
@@ -201,9 +201,9 @@ public class ZhanLing_Panel : SubUIBase
if (sz100 != null && _userData.isSupreme) giftType100 |= LevelGiftType.ZhiZun;
levelGiftitem_100.Init(
nf100?.product?.imageUrl ?? "", nf100?.count ?? 0,
lx100?.product?.imageUrl ?? "", lx100?.count ?? 0,
sz100?.product?.imageUrl ?? "", sz100?.count ?? 0,
ResolveGiftImageUrl(nf100), nf100?.count ?? 0,
ResolveGiftImageUrl(lx100), lx100?.count ?? 0,
ResolveGiftImageUrl(sz100), sz100?.count ?? 0,
_maxLevel, giftType100, isClaimed,
nf100?.type ?? 0, lx100?.type ?? 0, sz100?.type ?? 0);
levelGiftitem_100.gameObject.SetActive(true);
@@ -291,11 +291,16 @@ public class ZhanLing_Panel : SubUIBase
foreach (var gift in gifts)
{
var obj = Instantiate(buyLevelGiftitemPrefab, parent);
string url = !string.IsNullOrEmpty(gift.product?.imageUrl)
? APIManager.baseURL + gift.product.imageUrl
: "";
int type = gift.type;
PropEnum pe = type switch { 3 => (PropEnum)(gift.product?.type ?? 0), _ => PropEnum.none };
// GiftConfig 已移除 product,道具(type==3)图标与类型通过 otherId 查道具表
string url = "";
PropEnum pe = PropEnum.none;
if (gift.type == 3)
{
string imageUrl = ResolveGiftImageUrl(gift);
if (!string.IsNullOrEmpty(imageUrl))
url = APIManager.baseURL + imageUrl;
pe = (PropEnum)ResolveGiftPropType(gift);
}
int count = gift.isRandom ? gift.minCount : gift.count;
obj.Init(url, count, pe);
}
@@ -459,6 +464,25 @@ public class ZhanLing_Panel : SubUIBase
return (list != null && list.Count > 0) ? list[0] : null;
}
/// <summary>
/// 通过 otherId 在 propConfig 中查找道具图片地址。
/// 新版 GiftConfig 已移除 product,道具图标需用 otherId 查道具表。
/// </summary>
private static string ResolveGiftImageUrl(GiftConfig gift)
{
if (gift == null || string.IsNullOrEmpty(gift.otherId)) return "";
var match = GameManager.Instance?.gameConfig?.propConfig?.Find(p => p.number == gift.otherId);
return match?.imageUrl ?? "";
}
/// <summary>通过 otherId 在 propConfig 中查找道具类型</summary>
private static int ResolveGiftPropType(GiftConfig gift)
{
if (gift == null || string.IsNullOrEmpty(gift.otherId)) return 0;
var match = GameManager.Instance?.gameConfig?.propConfig?.Find(p => p.number == gift.otherId);
return match?.type ?? 0;
}
/// <summary>HTML 转 TextMeshPro 兼容格式</summary>
private static string HtmlToTMP(string html)
{