备份CatanBuilding瘦身独立工程
This commit is contained in:
42
Assets/Scripts/UI/Grade/PlayerGradeAchievement.cs
Normal file
42
Assets/Scripts/UI/Grade/PlayerGradeAchievement.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user