void Awake() { curUIType.type = UIFormType.Normal; curUIType.mode = UIFormShowMode.Normal; curUIType.lucencyType = UIFormLucencyType.Lucency; listView = UnityHelper.Find(transform, "ScrollView").GetComponent <ListView>(); listView.Init(); Init(); AchieveImage = UnityHelper.Find(transform, "AchievementTitle").GetComponent <Image>(); RankImage = UnityHelper.Find(transform, "RankTitle").GetComponent <Image>(); level1Text = UnityHelper.Find(transform, "LevelOneTitle").GetComponent <Text>(); level2Text = UnityHelper.Find(transform, "LevelTwoTitle").GetComponent <Text>(); RegisterBtnOnClick("Back", Back); RegisterBtnOnClick("AchievementTitle", Achievement); RegisterBtnOnClick("RankTitle", Rank); RegisterBtnOnClick("LevelOneTitle", LevelOne); RegisterBtnOnClick("LevelTwoTitle", LevelTwo); }
public void RegisterBtnOnClick(string btnName, EventTriggerListener.VoidDelegate del) { Transform button = UnityHelper.Find(gameObject.transform, btnName); EventTriggerListener.Get(button?.gameObject).onClick = del; }
void Awake() { AudioManager.PlayBackground("MusicMainMenu"); RandomUserImage(); RegisterBtnOnClick("Level-1", LoadLevelOne); RegisterBtnOnClick("Level-2", LoadLevelTwo); RegisterBtnOnClick("UserImage", GoHome); RegisterBtnOnClick("Settings", Settings); ID = UnityHelper.Find(transform, "ID").GetComponent <Text>(); ID.text = "ID: " + GenerateRandomNumber(8); //Debug.Log(ID.text); if (UIManager.isLogin) { if (!string.IsNullOrEmpty(PlayerPrefs.GetString("LevelOnePass"))) { passTime = UnityHelper.Find(UnityHelper.Find(transform, "Level-1"), "PassTime"); passTime.gameObject.SetActive(true); passTime.Find("Time").GetComponent <Text>().text = PlayerPrefs.GetString("LevelOnePass"); } if (!string.IsNullOrEmpty(PlayerPrefs.GetString("LevelTwoPass"))) { Transform level2 = UnityHelper.Find(transform, "Level-2"); Sprite sprite = Resources.Load("UIElements/Level-2", typeof(Sprite)) as Sprite; level2.GetComponent <Image>().overrideSprite = sprite; UnityHelper.Find(level2, "Lock").gameObject.SetActive(false); passTime = UnityHelper.Find(UnityHelper.Find(transform, "Level-2"), "PassTime"); passTime.gameObject.SetActive(true); passTime.Find("Time").GetComponent <Text>().text = PlayerPrefs.GetString("LevelTwoPass"); } } if (LevelPassInfo.levelOnePass) { passTime = UnityHelper.Find(UnityHelper.Find(transform, PassLevel.level), "PassTime"); passTime.gameObject.SetActive(true); passTime.Find("Time").GetComponent <Text>().text = CanvasControl.passTime; PlayerPrefs.SetString("LevelOnePass", CanvasControl.passTime); Transform level2 = UnityHelper.Find(transform, "Level-2"); Sprite sprite = Resources.Load("UIElements/Level-2", typeof(Sprite)) as Sprite; level2.GetComponent <Image>().overrideSprite = sprite; UnityHelper.Find(level2, "Lock").gameObject.SetActive(false); } if (LevelPassInfo.levelTwoPass) { passTime = UnityHelper.Find(UnityHelper.Find(transform, PassLevel.level), "PassTime"); passTime.gameObject.SetActive(true); passTime.Find("Time").GetComponent <Text>().text = CanvasControl.passTime; PlayerPrefs.SetString("LevelTwoPass", CanvasControl.passTime); passTime = UnityHelper.Find(UnityHelper.Find(transform, "Level-1"), "PassTime"); passTime.gameObject.SetActive(true); passTime.Find("Time").GetComponent <Text>().text = PlayerPrefs.GetString("LevelOnePass", CanvasControl.passTime); } }
private void Update() { volume = UnityHelper.Find(transform, "Slider").GetComponent <Slider>().value; AudioManager.ChangeVolume(volume); }