51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using Module.Log;
|
|||
|
|
|||
|
public class InitAptitudeStart : MonoBehaviour {
|
|||
|
|
|||
|
//资质的星级的计算范围写死在代码中吧!写张表浪费
|
|||
|
//半星 1星 1星半 2星 2星半 3星 3星半 4星 4星半 5星
|
|||
|
private float[] ApituteNums = {0,2f,4f, 6f, 8f, 10f };
|
|||
|
|
|||
|
public Image[] StartRect;
|
|||
|
|
|||
|
public void ClearInfo(bool state)
|
|||
|
{
|
|||
|
for(int i=0;i< StartRect.Length;i++)
|
|||
|
{
|
|||
|
StartRect[i].gameObject.SetActive(state);
|
|||
|
StartRect[i].fillAmount = 0;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void InitStart(float start)
|
|||
|
{
|
|||
|
LogModule.DebugLog("InitStart : " + start);
|
|||
|
start *= 10;
|
|||
|
if (StartRect.Length < ApituteNums.Length - 1)
|
|||
|
return;
|
|||
|
float lastNums = ApituteNums[0];
|
|||
|
for (int i = 0; i < StartRect.Length; i++)
|
|||
|
{
|
|||
|
StartRect[i].fillAmount = 0;
|
|||
|
}
|
|||
|
for (int index = 1; index < ApituteNums.Length; index++)
|
|||
|
{
|
|||
|
if(start < ApituteNums[index])
|
|||
|
{
|
|||
|
StartRect[index - 1].fillAmount = (start - lastNums) / (ApituteNums[index] - lastNums);
|
|||
|
break;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
StartRect[index - 1].fillAmount = 1;
|
|||
|
}
|
|||
|
lastNums = ApituteNums[index];
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|