You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PlumberUltimateAds/Assets/Scripts/LevelGroupButton.cs

55 lines
1.2 KiB
C#

4 weeks ago
/*
http://www.cgsoso.com/forum-211-1.html
CG Unity3d Unity3d VIP
CGSOSO CG
daily assets update for try.
U should buy the asset from home store if u use it in your project!
*/
using MS;
using TMPro;
4 weeks ago
using UnityEngine;
using UnityEngine.UI;
[ExecuteInEditMode]
public class LevelGroupButton : MonoBehaviour
{
public LevelGroup levelGroup;
public TMP_Text TitleLbl;
4 weeks ago
public TMP_Text LevelCompletdLbl;
4 weeks ago
public GameObject AwardGoldImage;
private void Start()
{
UpdateUI();
GetComponent<Button>().onClick.AddListener(delegate
{
HomeScene.instance.ShowDetailLevel(this);
HomeScene.instance.PlayButton();
GameObject.FindWithTag("LevelGroupPopup").GetComponent<Popup>().Close();
});
}
private void Update()
{
}
[ContextMenu("UpdateUI")]
public void UpdateUI()
{
base.name = levelGroup.LevelGroupName;
TitleLbl.text = base.name.ToUpper();
LevelCompletdLbl.text = levelGroup.CompletedLevel + " / " + levelGroup.TotalLevel;
AwardGoldImage.SetActive(levelGroup.CompletedLevel >= levelGroup.TotalLevel);
}
}