CTT/Unity/Assets/HotfixView/Entity/Shop.cs

40 lines
992 B
C#

using ET;
using Cal.DataTable;
using System;
using System.Collections.Generic;
namespace ET
{
public class ShopComponentAwakeSystem : AwakeSystem<ShopComponent>
{
public override void Awake(ShopComponent self)
{
self.Init();
}
}
public class ShopComponent:Entity
{
public UnOrderMultiMap<int, ShopBase> ShopBasePageDic = new UnOrderMultiMap<int, ShopBase>();
private bool isInit;
public void Init()
{
if (isInit) return;
isInit = true;
var dic = ShopBasePageDic;
dic.Clear();
foreach (ShopBase item in DataTableHelper.GetAll<ShopBase>())
{
dic.Add(item.Page, item);
}
}
public static List<ShopBase> GetShopBase(Scene scene,int pageIndex)
{
var dic = scene.GetComponent<ShopComponent>().ShopBasePageDic;
return dic[pageIndex];
}
}
}