Ejemplo n.º 1
0
    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;
    }
Ejemplo n.º 2
0
    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();
        }
    }
Ejemplo n.º 3
0
    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;
    }
Ejemplo n.º 4
0
    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);
        }
    }