先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
64 lines
2.2 KiB
C#
64 lines
2.2 KiB
C#
using asap.core;
|
|
using cfg;
|
|
using GameCore;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class PlayerGradeReward : MonoBehaviour
|
|
{
|
|
PanelScroll scrollRect;
|
|
Image bar;
|
|
GameObject gradeItem;
|
|
List<GradeItemData> gradeDatas = new List<GradeItemData>();
|
|
float itemHigh = 250;
|
|
private void Awake()
|
|
{
|
|
bar = transform.Find("ScrollView/Viewport/Content/bg_bar/bar").GetComponent<Image>();
|
|
scrollRect = transform.Find("ScrollView").GetComponent<PanelScroll>();
|
|
gradeItem = transform.Find("ScrollView/Viewport/Content/item").gameObject;
|
|
gradeItem.SetActive(false);
|
|
itemHigh = gradeItem.GetComponent<RectTransform>().sizeDelta.y;
|
|
scrollRect.isReversal = true;
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
gradeDatas.Clear();
|
|
var account = GContext.container.Resolve<Tables>().TbAccount.DataList;
|
|
int nextIndex = account.Count - 1;
|
|
for (int i = 0; i < account.Count; i++)
|
|
{
|
|
if (GContext.container.Resolve<PlayerData>().lv < account[i].ID)
|
|
{
|
|
nextIndex = i;
|
|
break;
|
|
}
|
|
}
|
|
bar.fillAmount = (GContext.container.Resolve<PlayerData>().lv - 1) / ((float)account[0].ID - 1);
|
|
int showCount = nextIndex + 10;
|
|
if (showCount > account.Count)
|
|
{
|
|
showCount = account.Count;
|
|
}
|
|
for (int i = 0; i < showCount; i++)
|
|
{
|
|
gradeDatas.Add(new GradeItemData() { account = account[i], nextIndex = nextIndex });
|
|
}
|
|
if (nextIndex > 0)
|
|
{
|
|
int startLv = account[nextIndex - 1].ID;
|
|
var nextAccountData = account[nextIndex];
|
|
gradeDatas[nextIndex - 1].fillAmount = (GContext.container.Resolve<PlayerData>().lv - startLv) / (float)(nextAccountData.ID - startLv);
|
|
gradeDatas[nextIndex].next = true;
|
|
nextIndex--;
|
|
}
|
|
else if (GContext.container.Resolve<PlayerData>().lv < account[0].ID)
|
|
{
|
|
gradeDatas[0].next = true;
|
|
}
|
|
gradeDatas[^1].bar = false;
|
|
scrollRect.Init<GradeItem, GradeItemData>(itemHigh, gradeItem, null, gradeDatas, _currentIndex: nextIndex, _minShowAdd: 3);
|
|
}
|
|
}
|