private void UpdatePlayerInfo() { AvatarFromUpgrade script = GameObject.Find("UI/Panels/MainMenuPanel/PlayerInfoPanel/AvatarImage").GetComponent <AvatarFromUpgrade>(); script.Initialize(Options.Avatar); GameObject.Find("UI/Panels/MainMenuPanel/PlayerInfoPanel/NicknameAndTitleText").GetComponent <Text>().text = Options.NickName + "\n" + Options.Title; }
private void AddAvailableAvatar(GenericUpgrade avatarUpgrade) { GameObject prefab = (GameObject)Resources.Load("Prefabs/MainMenu/AvatarImage", typeof(GameObject)); GameObject avatarPanel = MonoBehaviour.Instantiate(prefab, GameObject.Find("UI/Panels/OptionsPanel/Content/ContentViewPanel/AvatarSelectionViewPanel").transform); avatarPanel.name = avatarUpgrade.GetType().ToString(); AvatarFromUpgrade avatar = avatarPanel.GetComponent <AvatarFromUpgrade>(); avatar.Initialize(avatarUpgrade.GetType().ToString(), ChangeAvatar); if (avatarUpgrade.GetType().ToString() == Options.Avatar) { SetAvatarSelected(); } }
private void ShowPlayerView() { Transform parentTransform = GameObject.Find("UI/Panels/OptionsPanel/Content/ContentViewPanel").transform; string prefabPath = "Prefabs/MainMenu/Options/PlayerViewPanel"; GameObject prefab = (GameObject)Resources.Load(prefabPath, typeof(GameObject)); GameObject panel = Instantiate(prefab, parentTransform); InputField nameText = panel.transform.Find("NameInputPanel/InputField").GetComponent <InputField>(); nameText.text = Options.NickName; nameText.onEndEdit.AddListener(delegate { MainMenu.CurrentMainMenu.ChangeNickName(nameText.text); }); Button avatarButton = panel.transform.Find("AvatarChangePanel/AvatarButton").GetComponent <Button>(); AvatarFromUpgrade avatar = avatarButton.transform.GetComponent <AvatarFromUpgrade>(); avatar.Initialize(Options.Avatar.ToString(), delegate { MainMenu.CurrentMainMenu.ChangePanel("BrowseAvatarsPanel"); }); panel.transform.Find("TitleInputPanel/InputField").GetComponent <InputField>().text = Options.Title; }
private void AddAvailableAvatar(GenericUpgrade avatarUpgrade, int count) { GameObject prefab = (GameObject)Resources.Load("Prefabs/MainMenu/AvatarImage", typeof(GameObject)); GameObject avatarPanel = MonoBehaviour.Instantiate(prefab, GameObject.Find("UI/Panels/AvatarsPanel/ContentPanel").transform); int row = count / 8; int column = count - row * 8; avatarPanel.transform.localPosition = new Vector2(20 + column * 120, -20 - row * 110); avatarPanel.name = avatarUpgrade.GetType().ToString(); AvatarFromUpgrade avatar = avatarPanel.GetComponent <AvatarFromUpgrade>(); avatar.Initialize(avatarUpgrade.GetType().ToString(), ChangeAvatar); if (avatarUpgrade.GetType().ToString() == Options.Avatar) { SetAvatarSelected(avatarPanel.transform.position); } }