using UnityEngine;
|
using UnityEngine.UI;
|
using DG.Tweening;
|
using System;
|
using System.Collections.Generic;
|
|
|
//祈灵概率
|
public class MinggePrayRateCell : MonoBehaviour
|
{
|
[SerializeField] Text rateText;
|
[SerializeField] Text nextRateText;
|
[SerializeField] Image qualityImg;
|
[SerializeField] Image arrowImg;
|
|
// maxRateNum 概率最大值,用于计算百分比取最后两位
|
public void Display(int index, List<int> bigRateList, List<int> littleRateList, int maxRateNum)
|
{
|
var rate = littleRateList[index];
|
var nextRate = bigRateList[index];
|
|
rateText.text = (rate / (float)maxRateNum * 100).ToString("0.##") + "%";
|
nextRateText.text = (nextRate / (float)maxRateNum * 100).ToString("0.##") + "%";
|
qualityImg.SetSprite("MinggeNameBG" + (index + 1));
|
if (rate == nextRate)
|
{
|
arrowImg.SetActive(false);
|
}
|
else
|
{
|
arrowImg.SetActive(true);
|
arrowImg.SetSprite(rate > nextRate ? "FightPointDown" : "FightPointUP");
|
}
|
|
}
|
|
|
}
|