using UnityEngine; using UnityEngine.UI; public class ProfileSlot : MonoBehaviour { public int slotID; public GameObject profileContainer; public GameObject genderContainer; public GameObject chooseBtn; public Hover[] genderOptions; public GameObject[] profileGameModeBtns; public string profileName = "Enter your profile name..."; public InputField profileNameText; public Text profileLevelText; public Text profileTotalFishText; private ProfileCreation profileCreation; private void Start() { profileCreation = Object.FindObjectOfType(); } public void SelectGameModeBtn(int index) { profileCreation.SelectGameMode(slotID, index); } public void ShowGenderSelection() { genderContainer.SetActive(value: true); genderOptions[0].isSelected = false; genderOptions[1].isSelected = false; genderOptions[Singleton.Instance.GetSpecifiedPlayerData(slotID).PlayerSexIndex].isSelected = true; } public void SetGender(int gendderIndex) { Singleton.Instance.GetSpecifiedPlayerData(slotID).PlayerSexIndex = gendderIndex; ShowGenderSelection(); } public void SetProfileName() { if (profileNameText.text == "") { profileNameText.placeholder.GetComponent().text = LanguageManager.Instance.GetText("ENTER_NAME"); return; } for (int i = 0; i < GameManager.Instance._playerData.Player.Count; i++) { if (profileNameText.text == Singleton.Instance.GetSpecifiedPlayerData(i).PlayerName) { if (!(Singleton.Instance.GetSpecifiedPlayerData(slotID).PlayerName == Singleton.Instance.GetSpecifiedPlayerData(i).PlayerName)) { profileNameText.text = ""; profileNameText.placeholder.GetComponent().text = LanguageManager.Instance.GetText("PROFILE_NAME_EXIST"); profileNameText.interactable = true; } return; } } Singleton.Instance.GetSpecifiedPlayerData(slotID).PlayerName = profileNameText.text; profileCreation.ShowProfileSlots(); } public void onEditName() { profileNameText.text = profileNameText.text.Replace(" ", ""); } public void ChooseProfile() { profileCreation.ChooseProfile(slotID); Object.FindObjectOfType().InitializeBackgroundMusic(); } public void DeleteProfile() { profileCreation.profileIDtoDellete = slotID; GameManager.Instance.CreateMessageBox("DELETE_PROFILE_QUESTION", Object.FindObjectOfType().transform, 5); } }