71 lines
2.6 KiB
C#
71 lines
2.6 KiB
C#
using asap.core;
|
|
using cfg;
|
|
using GameCore;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class ClubChestPopupPanel : MonoBehaviour
|
|
{
|
|
Button btn_close;
|
|
PanelScroll scrollRect;
|
|
Image bar;
|
|
GameObject gradeItem;
|
|
List<ChestRewardItemData> gradeDatas = new List<ChestRewardItemData>();
|
|
float itemHigh = 250;
|
|
private void Awake()
|
|
{
|
|
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
|
bar = transform.Find("root/root_reward/ScrollView/Viewport/Content/bg_bar/bar").GetComponent<Image>();
|
|
scrollRect = transform.Find("root/root_reward/ScrollView").GetComponent<PanelScroll>();
|
|
gradeItem = transform.Find("root/root_reward/ScrollView/Viewport/Content/item").gameObject;
|
|
gradeItem.SetActive(false);
|
|
itemHigh = gradeItem.GetComponent<RectTransform>().sizeDelta.y;
|
|
scrollRect.isReversal = true;
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
//btn_close.onClick.AddListener(() =>
|
|
//{
|
|
// UIManager.Instance.DestroyUI(UITypes.ClubChestPopupPanel);
|
|
//});
|
|
//gradeDatas.Clear();
|
|
////等级相关转为工会积分Todo
|
|
//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 / (float)account[0].ID;
|
|
//int showCount = nextIndex + 10;
|
|
//if (showCount > account.Count)
|
|
//{
|
|
// showCount = account.Count;
|
|
//}
|
|
//for (int i = 0; i < showCount; i++)
|
|
//{
|
|
// gradeDatas.Add(new ChestRewardItemData() { 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<ChestRewardItem, ChestRewardItemData>(itemHigh, gradeItem, null, gradeDatas, _currentIndex: nextIndex, _minShowAdd: 3);
|
|
}
|
|
}
|