コード例 #1
0
    //----------------------------------Creating Panels
    //runs when a session is started, to choose your profile
    public void OnProfilePhaseEnter()
    {
        //show profile cards
        sessionProfileCanvas.enabled = true;
        List <Profile> tempProfList = ProfileData.ProfileLoadList();

        Profile_UICard[] uiCardArray = new Profile_UICard[tempProfList.Count];
        //creates the profiles under the canvas to be selected by the user
        for (int i = 0; i < tempProfList.Count; i++)
        {
            GameObject     uiCardTemp = (GameObject)Instantiate(profileUICard_Prefab, Vector3.zero, Quaternion.identity);
            Profile_UICard temp       = uiCardTemp.GetComponent <Profile_UICard>();
            temp.InitializeProfileCard(tempProfList[i]);
            uiCardArray[i] = temp;
        }
        SpaceProfiles(uiCardArray);
        AssignProfileNavigation(uiCardArray);

        //swtiches the current state of the profile viewing...
        //will be SessionAdd or View
        if (SessionManager.instance.c_SessionState == SessionManager.SessionStates.ProfileChoose)
        {
            c_ProfileState = ProfileStates.SessionAdd;
        }
        else if (SessionManager.instance.c_SessionState == SessionManager.SessionStates.None)
        {
            c_ProfileState = ProfileStates.View;
            foreach (Profile_UICard disTemp in uiCardArray)
            {
                disTemp.GetComponent <Button> ().enabled = false;
            }
        }
    }
コード例 #2
0
ファイル: ProfileManager.cs プロジェクト: sfraguela/ZenPal
    //----------------------------------Spacing Panels
    void SpaceProfiles(Profile_UICard[] toSpaceList)
    {
        Debug.Log("Positioning " + toSpaceList.Length.ToString() + " Cards...");

        for (int i = 0; i < toSpaceList.Length; i++)
        {
            //spacing and instantiating the panels
            toSpaceList[i].gameObject.transform.SetParent(scrollPanel.transform);
            toSpaceList[i].gameObject.transform.localScale = new Vector3(3.3f, 4.5f, 1f);
            toSpaceList[i].GetComponent<RectTransform>().transform.position = new Vector3((Screen.width/4f * i) + Screen.width / 8f, Screen.height/2f, 0);
        }

        Debug.Log("Finished Positioning");
    }
コード例 #3
0
ファイル: ProfileManager.cs プロジェクト: sfraguela/ZenPal
    //----------------------------------Buttons
    private void AssignProfileNavigation(Profile_UICard[] profileList)
    {
        if(profileList.Length > 0)
        {
            Navigation nav = cancelButton.navigation;
            nav.selectOnUp = profileList[0].gameObject.GetComponent<Selectable>();
            nav.selectOnDown = profileList[0].gameObject.GetComponent<Selectable>();
            cancelButton.navigation = nav;

            nav = continueButton.navigation;
            nav.selectOnUp = profileList[0].gameObject.GetComponent<Selectable>();
            nav.selectOnDown = profileList[0].gameObject.GetComponent<Selectable>();
            continueButton.navigation = nav;

            nav = backButton.navigation;
            nav.selectOnUp = profileList[0].gameObject.GetComponent<Selectable>();
            nav.selectOnDown = profileList[0].gameObject.GetComponent<Selectable>();
            backButton.navigation = nav;

            nav = profileList[0].gameObject.GetComponent<Selectable>().navigation;
            nav.selectOnLeft = profileList[profileList.Length - 1].gameObject.GetComponent<Button>();
            nav.selectOnRight = profileList[1].gameObject.GetComponent<Button>();
            if (MenuManager.instance.c_MenuState == MenuInfo.MenuStates.Profiles)
            {
                nav.selectOnDown = backButton;
                nav.selectOnUp = backButton;
            }
            else if (MenuManager.instance.c_MenuState == MenuInfo.MenuStates.Main)         //Apparently the profile select on session is the "Main" state
            {
                nav.selectOnDown = cancelButton;
                nav.selectOnUp = cancelButton;
            }

            profileList[0].gameObject.GetComponent<Selectable>().navigation = nav;

            for(int i = 1; i < profileList.Length; i++)
            {
                //nav = profileList[i].gameObject.GetComponent<Selectable>().navigation;
                nav.selectOnLeft = profileList[i - 1].gameObject.GetComponent<Button>();
                if(i == profileList.Length - 1)
                {
                    nav.selectOnRight = profileList[0].gameObject.GetComponent<Button>();

                }
                else
                {
                    nav.selectOnRight = profileList[i + 1].gameObject.GetComponent<Button>();
                }
                //nav.selectOnDown = continueButton;
                //nav.selectOnUp = continueButton;
                profileList[i].gameObject.GetComponent<Selectable>().navigation = nav;
            }
        }
    }
コード例 #4
0
ファイル: ProfileManager.cs プロジェクト: sfraguela/ZenPal
    //----------------------------------Creating Panels
    //runs when a session is started, to choose your profile
    public void OnProfilePhaseEnter()
    {
        //show profile cards
        sessionProfileCanvas.enabled = true;
        List<Profile> tempProfList = ProfileData.ProfileLoadList ();
        Profile_UICard[] uiCardArray = new Profile_UICard[tempProfList.Count];
        //creates the profiles under the canvas to be selected by the user
        for (int i = 0; i < tempProfList.Count; i ++){
            GameObject uiCardTemp = (GameObject) Instantiate(profileUICard_Prefab, Vector3.zero, Quaternion.identity);
            Profile_UICard temp = uiCardTemp.GetComponent<Profile_UICard>();
            temp.InitializeProfileCard(tempProfList[i]);
            uiCardArray[i] = temp;
        }
        SpaceProfiles (uiCardArray);
        AssignProfileNavigation (uiCardArray);

        //swtiches the current state of the profile viewing...
        //will be SessionAdd or View
        if (SessionManager.instance.c_SessionState == SessionManager.SessionStates.ProfileChoose) {
            c_ProfileState = ProfileStates.SessionAdd;
        } else if (SessionManager.instance.c_SessionState == SessionManager.SessionStates.None) {
            c_ProfileState = ProfileStates.View;
            foreach (Profile_UICard disTemp in uiCardArray) {
                disTemp.GetComponent<Button> ().enabled = false;
            }
        }
    }