public Level(string name, string displayName, bool levelLocked, LevelStars stars, LevelGems gems, int gemsAcquired) { this.name = name; this.displayName = displayName; this.levelLocked = levelLocked; this.stars = stars; this.gems = gems; this.gemsAcquired = gemsAcquired; }
void Awake() { Transform starsTransform = transform.Find("Stars"); if (starsTransform) { stars = starsTransform.GetComponent<LevelStars>(); } panel = GetComponent<UIDragPanelContents>().draggablePanel.panel; if (levelIdx <= maxLevels) { CompanionsManager.Instance.RegisterButton(this, levelIdx); } else { if (levelIdx == maxLevels + 1) { gameObject.GetComponent<NGuiEventsToPlaymakerFsmEvents>().targetFSM = CompanionsManager.Instance.gameEndFsm; transform.Find("Label").GetComponent<UILabel>().text = "?"; } else { gameObject.SetActive(false); } } UpdateButtonStatus(); /* // add name lable and name board if (this.name == "01 Level Button") { return; } GameObject nameLabelObj = GameObject.Find("Map Panel Portrait/Contents/01 Level Button/NameLabel"); GameObject nameBoardObj = GameObject.Find("Map Panel Portrait/Contents/01 Level Button/NameBoard"); newNameLabelObj = (GameObject)Instantiate(nameLabelObj); newNameLabelObj.transform.parent = this.transform; newNameLabelObj.transform.localScale = new Vector3(0, 24, 1); // new Vector3(24, 24, 1); if (levelIdx > lastUnlockedLevel) { newNameLabelObj.transform.localPosition = new Vector3(0, 0, -4); } else { newNameLabelObj.transform.localPosition = new Vector3(0, 42, -4); } newNameLabelObj.name = "NameLabel"; UILabel nameLabelCom = newNameLabelObj.GetComponent<UILabel>(); nameLabelCom.maxLineCount = 1; nameLabelCom.lineWidth = 130; newNameBoardObj = (GameObject)Instantiate(nameBoardObj); newNameBoardObj.transform.parent = this.transform; newNameBoardObj.transform.localScale = new Vector3(0, 56, 1); //new Vector3(155, 76, 1); if (levelIdx > lastUnlockedLevel) { newNameBoardObj.transform.localPosition = new Vector3(0, 0, -2); } else { newNameBoardObj.transform.localPosition = new Vector3(0, 42, -2); } newNameBoardObj.name = "NameBoard"; */ }
public static void SetLevelStars(LevelNumberSO levelNumberSO, LevelStars levelStars) { levelNumberStarsDic[levelNumberSO] = levelStars; SaveSystem.Save(); }
void Awake() { Transform starsTransform = transform.Find("Stars"); if (starsTransform) { stars = starsTransform.GetComponent <LevelStars>(); } panel = GetComponent <UIDragPanelContents>().draggablePanel.panel; if (levelIdx <= maxLevels) { CompanionsManager.Instance.RegisterButton(this, levelIdx); } else { if (levelIdx == maxLevels + 1) { gameObject.GetComponent <NGuiEventsToPlaymakerFsmEvents>().targetFSM = CompanionsManager.Instance.gameEndFsm; transform.Find("Label").GetComponent <UILabel>().text = "?"; } else { gameObject.SetActive(false); } } UpdateButtonStatus(); /* * // add name lable and name board * if (this.name == "01 Level Button") * { * return; * } * * GameObject nameLabelObj = GameObject.Find("Map Panel Portrait/Contents/01 Level Button/NameLabel"); * GameObject nameBoardObj = GameObject.Find("Map Panel Portrait/Contents/01 Level Button/NameBoard"); * * newNameLabelObj = (GameObject)Instantiate(nameLabelObj); * newNameLabelObj.transform.parent = this.transform; * newNameLabelObj.transform.localScale = new Vector3(0, 24, 1); // new Vector3(24, 24, 1); * if (levelIdx > lastUnlockedLevel) * { * newNameLabelObj.transform.localPosition = new Vector3(0, 0, -4); * } * else * { * newNameLabelObj.transform.localPosition = new Vector3(0, 42, -4); * } * newNameLabelObj.name = "NameLabel"; * * UILabel nameLabelCom = newNameLabelObj.GetComponent<UILabel>(); * nameLabelCom.maxLineCount = 1; * nameLabelCom.lineWidth = 130; * * newNameBoardObj = (GameObject)Instantiate(nameBoardObj); * newNameBoardObj.transform.parent = this.transform; * newNameBoardObj.transform.localScale = new Vector3(0, 56, 1); //new Vector3(155, 76, 1); * if (levelIdx > lastUnlockedLevel) * { * newNameBoardObj.transform.localPosition = new Vector3(0, 0, -2); * } * else * { * newNameBoardObj.transform.localPosition = new Vector3(0, 42, -2); * } * newNameBoardObj.name = "NameBoard"; * */ }