43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
using asap.core;
|
|
using cfg;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
|
|
public class PlayerGradeAchievement : MonoBehaviour
|
|
{
|
|
GameObject item;
|
|
Transform content;
|
|
List<StatisticItem> statisticItems = new List<StatisticItem>();
|
|
private void Awake()
|
|
{
|
|
item = transform.Find("ScrollView/Viewport/Content/item").gameObject;
|
|
content = transform.Find("ScrollView/Viewport/Content");
|
|
item.SetActive(false);
|
|
}
|
|
private void Start()
|
|
{
|
|
List<Statistics> dataList = GContext.container.Resolve<Tables>().TbStatistics.DataList;
|
|
List<Statistics> dataTable = dataList.Where(x => x.Sort != 0).ToList();
|
|
dataTable.Sort((a, b) => a.Sort.CompareTo(b.Sort));
|
|
for (int i = 0; i < dataTable.Count; i += 3)
|
|
{
|
|
var go = Instantiate(item, content);
|
|
go.SetActive(true);
|
|
for (int j = 0; j < 3; j++)
|
|
{
|
|
StatisticItem statisticItem = go.transform.GetChild(j).GetComponent<StatisticItem>();
|
|
if (i + j < dataTable.Count)
|
|
{
|
|
statisticItem.Init(dataTable[i + j]);
|
|
statisticItems.Add(statisticItem);
|
|
}
|
|
else
|
|
{
|
|
statisticItem.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|