31 lines
		
	
	
		
			758 B
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			758 B
		
	
	
	
		
			C#
		
	
	
	
| using System.Collections;
 | |
| using System.Collections.Generic;
 | |
| using UnityEngine;
 | |
| using UnityEngine.UI;
 | |
| 
 | |
| public class LevelDisplay : MonoBehaviour
 | |
| {
 | |
|     [SerializeField] Text mTxtLevel;
 | |
|     [SerializeField] Transform mCtnSpots;
 | |
| 
 | |
|     private List<LevelSpot> mSpots;
 | |
| 
 | |
|     private void Awake()
 | |
|     {
 | |
|         mSpots = Utils.GetChildListFirstLayer<LevelSpot>(mCtnSpots);
 | |
|     }
 | |
| 
 | |
|     public void Init(int pLevel)
 | |
|     {
 | |
|         mTxtLevel.text = string.Format(LanguageConfig.Instance.GetText("Level"), pLevel);
 | |
| 
 | |
|         int tCurIndex = pLevel % mSpots.Count - 1;
 | |
|         if (tCurIndex < 0)
 | |
|             tCurIndex += mSpots.Count;
 | |
| 
 | |
|         for (int i = 0; i < mSpots.Count; i++)
 | |
|         {
 | |
|             mSpots[i].InitSpot(i < tCurIndex, i == tCurIndex);
 | |
|         }
 | |
|     }
 | |
| } |