// ------------------------------------------- /* * UpdateSingleSkill */ public void UpdateSingleSkill(string _nameSkill, int _value) { for (int i = 0; i < m_skillsList.Count; i++) { SkillModel dataItem = m_skillsList[i]; if (dataItem.Name == _nameSkill) { dataItem.Value = _value; } } SetFormattedSkills(); }
// ------------------------------------------- /* * SetFormattedSkills */ private void SetFormattedSkills() { m_skills = ""; for (int i = 0; i < m_skillsList.Count; i++) { SkillModel dataItem = m_skillsList[i]; m_skills += dataItem.Name + TOKEN_SEPARATOR_SKILL_PARAMETER + dataItem.Value; if (i + 1 < m_skillsList.Count) { m_skills += TOKEN_SEPARATOR_SKILL_LINE; } } }
// ------------------------------------------- /* * GetFormattedSkills */ public void GetFormattedSkills() { m_skillsList = new List <SkillModel>(); if (m_skills.Length == 0) { m_skills = MenusScreenController.Instance.ProviderSkills; } string[] skillItem = m_skills.Split(new string[] { TOKEN_SEPARATOR_SKILL_LINE }, StringSplitOptions.None); for (int i = 0; i < skillItem.Length; i++) { string[] dataItem = skillItem[i].Split(TOKEN_SEPARATOR_SKILL_PARAMETER); SkillModel newSkill = new SkillModel(dataItem[0], int.Parse(dataItem[1])); m_skillsList.Add(newSkill); } }
// ------------------------------------------- /* * LoadUserData */ public void LoadUserData() { if (!m_userData.IsBanned()) { m_container.Find("Title").GetComponent <Text>().text = LanguageController.Instance.GetText("screen.profile.proovider.profile"); } m_container.Find("Name").GetComponent <Text>().text = m_userData.Nickname; m_container.Find("Description").GetComponent <Text>().text = LanguageController.Instance.GetText("screen.profile.proovider.a.few.words.about"); if (m_container.Find("StarsScoreGlobal") != null) { m_container.Find("StarsScoreGlobal").GetComponent <PanelRatingView>().Initialize(m_userData.Scoreprovider, m_userData.Votesprovider, LanguageController.Instance.GetText("message.proovider.rating"), true, "", !m_isDisplayInfo); } // SKILLS List <Transform> skillTransforms = new List <Transform>(); Transform panelSkillValue = null; int counterSkill = 0; do { panelSkillValue = m_container.Find("StarsScore_" + counterSkill); if (panelSkillValue != null) { panelSkillValue.gameObject.SetActive(false); skillTransforms.Add(panelSkillValue); } counterSkill++; } while (panelSkillValue != null); // FILL DATA SKILLS m_skillsPanels.Clear(); for (int i = 0; i < skillTransforms.Count; i++) { if (i < m_userData.SkillsList.Count) { SkillModel itemSkill = m_userData.SkillsList[i]; string nameSkill = itemSkill.Name; int valueSkill = itemSkill.Value; panelSkillValue = skillTransforms[i]; if (panelSkillValue != null) { panelSkillValue.GetComponent <PanelRatingView>().Initialize(valueSkill + 1, 1, LanguageController.Instance.GetText("screen.profile.skill.name." + nameSkill), true, EVENT_SCREENPROVIDERPROFILE_CLICK_PROPERTY, !m_isDisplayInfo); panelSkillValue.GetComponent <PanelRatingView>().Property = nameSkill; m_skillsPanels.Add(panelSkillValue.gameObject); panelSkillValue.gameObject.SetActive(true); } } } // DESCRIPTION if (m_isDisplayInfo) { m_container.Find("ScrollDescriptionValue/DescriptionValue").GetComponent <Text>().supportRichText = true; m_container.Find("ScrollDescriptionValue/DescriptionValue").GetComponent <Text>().text = m_userData.Description; } else { m_container.Find("DescriptionValue").GetComponent <InputField>().text = m_userData.Description; } // ADD NEW IMAGE EXPERIENCE Transform btnAddImage = m_container.Find("Button_Images"); if (btnAddImage != null) { btnAddImage.Find("Title").GetComponent <Text>().text = LanguageController.Instance.GetText("screen.profile.proovider.add.image.experience"); btnAddImage.GetComponent <Button>().onClick.AddListener(OnAddNewImageExperience); } if (m_container.Find("YourImagesExperience/Title") != null) { m_container.Find("YourImagesExperience/Title").GetComponent <Text>().text = LanguageController.Instance.GetText("screen.profile.proovider.images.experience"); } if (m_container.Find("YourHistoryWorks/Title") != null) { m_container.Find("YourHistoryWorks/Title").GetComponent <Text>().text = LanguageController.Instance.GetText("screen.profile.proovider.related.works"); } UIEventController.Instance.DelayUIEvent(EVENT_SCREENPROVIDERPROFILE_LOAD_USER_DATA_EXPERIENCE, 0.1f); }
// ------------------------------------------- /* * Copy */ public void Copy(SkillModel _skill) { m_name = _skill.Name; m_value = _skill.Value; }