private void Awake() { //JsonManager.Instance.UpdateLevelStar(0,0,3); levelData = JsonManager.Instance.ReadLevelStar(); levelButtonSet = new HashSet <LevelButton>(); selectMapManager = transform.parent.Find("MapScrollView").GetComponent <SelectMapManager>(); prefabParent = transform.Find("LevelList"); transform.Find("BackButton").GetComponent <Button>().onClick .AddListener(() => { gameObject.SetActive(false); selectMapManager.gameObject.SetActive(true); }); gameObject.SetActive(false); }
private void SetLock(SelectMapManager manager) { if (manager.nowAllStar >= needStar) { GetComponent <Button>().interactable = true; startBg.SetActive(true); lockBg.SetActive(false); SetStarText(); GetComponent <Button>().onClick.AddListener( () => { OnClick(manager); }); } else { GetComponent <Button>().interactable = false; startBg.SetActive(false); lockBg.SetActive(true); needStarText.text = needStar.ToString(); } }
private void OnClick(SelectMapManager manager) { manager.ChooseMap(nowMap); }
public void SetStarAndLock(int _nowMap, int _nowStar, int _needStar, int _maxStar, SelectMapManager manager) { nowMap = _nowMap; startBg = transform.Find("StarBg").gameObject; lockBg = transform.Find("LockBg").gameObject; starText = transform.Find("StarBg/StarText").GetComponent <Text>(); needStarText = transform.Find("LockBg/NeedStarImage/NeedStarText").GetComponent <Text>(); needStar = _needStar; maxStar = _maxStar; nowStar = _nowStar; SetLock(manager); }