备份CatanBuilding瘦身独立工程
This commit is contained in:
57
Assets/Scripts/UI/Rod/StarItemRoot.cs
Normal file
57
Assets/Scripts/UI/Rod/StarItemRoot.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using GameCore;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class StarItemRoot : MonoBehaviour
|
||||
{
|
||||
public List<GameObject> enhance_star_empty_list = new List<GameObject>();
|
||||
public List<Image> enhance_star_empty_image = new List<Image>();
|
||||
public List<StarItem> enhance_starList = new List<StarItem>();
|
||||
private void Reset()
|
||||
{
|
||||
for (int i = 1; i <= 5; i++)
|
||||
{
|
||||
enhance_starList.Add(transform.Find($"star/star{i}").GetComponent<StarItem>());
|
||||
enhance_star_empty_list.Add(transform.Find($"star_empty/star{i}").gameObject);
|
||||
enhance_star_empty_image.Add(transform.Find($"star_empty/star{i}/star").GetComponent<Image>());
|
||||
}
|
||||
}
|
||||
public void SetStar(int star, int maxAscent, bool isUp = false)
|
||||
{
|
||||
PlayerFishData.SetRodStar(star, maxAscent,
|
||||
enhance_star_empty_list,
|
||||
enhance_star_empty_image,
|
||||
enhance_starList,
|
||||
isUp);
|
||||
}
|
||||
public void ShowStar(int star, int maxAscent)
|
||||
{
|
||||
int max = maxAscent / 3;
|
||||
if (max > 5)
|
||||
{
|
||||
max = 5;
|
||||
Debug.LogError($"钓竿最大强化星级不能超过15星");
|
||||
}
|
||||
int count = star % max;
|
||||
if (star >= maxAscent)
|
||||
{
|
||||
count = max;
|
||||
}
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(ShowStar(count));
|
||||
}
|
||||
IEnumerator ShowStar(int count)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
enhance_starList[i].Hide();
|
||||
}
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
enhance_starList[i].PlayShow();
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user