Files
test/Assets/PerfectWorld/Scripts/Shop/CECShopArrayItems.cs
2025-12-03 16:43:11 +07:00

61 lines
1.5 KiB
C#

// Filename : CECShopArrayItems.cs
// Creator : Xu Wenbin
// Date : 2013/12/11
// Converted to C#: 2024
using System.Collections.Generic;
using System.Linq;
namespace PerfectWorld.Scripts.Shop
{
public abstract class CECShopArrayItems : CECShopBase
{
protected List<GShopItem> m_pItems;
public CECShopArrayItems(List<GShopItem> pItems)
{
m_pItems = pItems;
}
public override int GetCount()
{
return m_pItems != null ? m_pItems.Count : 0;
}
public override GShopItem? GetItem(int index)
{
if (m_pItems != null && index >= 0 && index < m_pItems.Count)
{
return m_pItems[index];
}
return null;
}
public static bool IsSame(List<GShopItem> lhs, List<GShopItem> rhs)
{
bool result = false;
if (lhs == rhs)
{
result = true;
}
else if (lhs != null && rhs != null)
{
if (lhs.Count == rhs.Count)
{
result = true;
for (int u = 0; u < lhs.Count; ++u)
{
if (!CECShopBase.IsSame(lhs[u], rhs[u]))
{
result = false;
break;
}
}
}
}
return result;
}
}
}