private void SetWorkerAbilitiesText()
        {
            TextAbilities.text = UIWorkers.GetWorkerAbilitiesString(SelectedWorker);
            RectTransform transform = TextAbilities.transform.parent.GetComponent <RectTransform>();
            Vector2       newSize   = new Vector2(transform.rect.width, TextAbilities.preferredHeight);

            transform.sizeDelta = newSize;
        }
        private void SetWorkerInfoText(SharedWorker selectedWorker)
        {
            if (null != selectedWorker)
            {
                TextName.text        = UIWorkers.GetWorkerNameString(selectedWorker);
                TextSalary.text      = UIWorkers.GetWorkerSalaryString(selectedWorker);
                TextExpierience.text = UIWorkers.GetWorkerExpierienceString(selectedWorker);

                TextAbilities.text = UIWorkers.GetWorkerAbilitiesString(selectedWorker);
                RectTransform textTransform = TextAbilities.rectTransform.parent.GetComponent <RectTransform>();
                textTransform.sizeDelta = new Vector2(textTransform.sizeDelta.x, TextAbilities.preferredHeight);
            }
            else
            {
                TextName.text        = string.Empty;
                TextSalary.text      = string.Empty;
                TextAbilities.text   = string.Empty;
                TextExpierience.text = string.Empty;
            }
        }
Ejemplo n.º 3
0
        private void SetWorkerInfoText(SharedWorker selectedWorker)
        {
            if (null != selectedWorker)
            {
                TextName.gameObject.SetActive(true);
                TextSalary.gameObject.SetActive(true);
                TextAbilities.gameObject.SetActive(true);
                TextExpierience.gameObject.SetActive(true);

                TextName.text = UIWorkers.GetWorkerNameString(selectedWorker);
                SetWorkerSalaryText(selectedWorker);
                TextExpierience.text = UIWorkers.GetWorkerExpierienceString(selectedWorker);
                TextAbilities.text   = UIWorkers.GetWorkerAbilitiesString(selectedWorker);
                RectTransform textObjectTransform = TextAbilities.transform.parent.GetComponent <RectTransform>();
                textObjectTransform.sizeDelta = new Vector2(textObjectTransform.sizeDelta.x, TextAbilities.preferredHeight);
            }
            else
            {
                TextName.gameObject.SetActive(false);
                TextSalary.gameObject.SetActive(false);
                TextAbilities.gameObject.SetActive(false);
                TextExpierience.gameObject.SetActive(false);
            }
        }