//----------------------------------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; } } }
//create profile button public void OnCreateProfileButton() { EnableCreationPanel(true); createProfileButton.gameObject.SetActive(false); viewProfileButton.gameObject.SetActive(false); c_ProfileState = ProfileStates.Creation; //set active thing to be the name panel UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(profileCreationNamePanel); }
//----------------------------------Buttons //back button public void BackProfileButtonHit() { if (c_ProfileState == ProfileStates.View) { CloseProfilesPanels (); createProfileButton.gameObject.SetActive(true); viewProfileButton.gameObject.SetActive(true); c_ProfileState = ProfileStates.None; }else if(c_ProfileState == ProfileStates.Creation){ //close the profiles CreationCanvas.GetComponent<CreateProfile>().OnCreationEnded(); Debug.Log ("Creation Ended"); createProfileButton.gameObject.SetActive(true); viewProfileButton.gameObject.SetActive(true); c_ProfileState = ProfileStates.None; } else { MenuManager.instance.SwitchMenu (MenuInfo.MenuStates.Main); } }
//----------------------------------Buttons //back button public void BackProfileButtonHit() { if (c_ProfileState == ProfileStates.View) { CloseProfilesPanels(); createProfileButton.gameObject.SetActive(true); viewProfileButton.gameObject.SetActive(true); c_ProfileState = ProfileStates.None; } else if (c_ProfileState == ProfileStates.Creation) { //close the profiles CreationCanvas.GetComponent <CreateProfile>().OnCreationEnded(); Debug.Log("Creation Ended"); createProfileButton.gameObject.SetActive(true); viewProfileButton.gameObject.SetActive(true); c_ProfileState = ProfileStates.None; } else { MenuManager.instance.SwitchMenu(MenuInfo.MenuStates.Main); } }
//----------------------------------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; } } }
//create profile button public void OnCreateProfileButton() { EnableCreationPanel (true); createProfileButton.gameObject.SetActive(false); viewProfileButton.gameObject.SetActive(false); c_ProfileState = ProfileStates.Creation; //set active thing to be the name panel UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(profileCreationNamePanel); }