Exemplo n.º 1
0
    // Token: 0x06000655 RID: 1621 RVA: 0x00035888 File Offset: 0x00033A88
    private void FillTextList()
    {
        foreach (TextsDialog.TextInfo textInfo in this.m_texts)
        {
            UnityEngine.Object.Destroy(textInfo.m_listElement);
        }
        this.m_texts.Clear();
        this.UpdateTextsList();
        for (int i = 0; i < this.m_texts.Count; i++)
        {
            TextsDialog.TextInfo text       = this.m_texts[i];
            GameObject           gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_elementPrefab, Vector3.zero, Quaternion.identity, this.m_listRoot);
            gameObject.SetActive(true);
            (gameObject.transform as RectTransform).anchoredPosition = new Vector2(0f, (float)(-(float)i) * this.m_spacing);
            Utils.FindChild(gameObject.transform, "name").GetComponent <Text>().text = Localization.instance.Localize(text.m_topic);
            text.m_listElement = gameObject;
            text.m_selected    = Utils.FindChild(gameObject.transform, "selected").gameObject;
            text.m_selected.SetActive(false);
            gameObject.GetComponent <Button>().onClick.AddListener(delegate
            {
                this.OnSelectText(text);
            });
        }
        float size = Mathf.Max(this.m_baseListSize, (float)this.m_texts.Count * this.m_spacing);

        this.m_listRoot.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, size);
        if (this.m_texts.Count > 0)
        {
            this.m_recipeEnsureVisible.CenterOnItem(this.m_texts[0].m_listElement.transform as RectTransform);
        }
    }
Exemplo n.º 2
0
 // Token: 0x0600065A RID: 1626 RVA: 0x00035B24 File Offset: 0x00033D24
 private void ShowText(TextsDialog.TextInfo text)
 {
     this.m_textAreaTopic.text = Localization.instance.Localize(text.m_topic);
     this.m_textArea.text      = Localization.instance.Localize(text.m_text);
     foreach (TextsDialog.TextInfo textInfo in this.m_texts)
     {
         textInfo.m_selected.SetActive(false);
     }
     text.m_selected.SetActive(true);
 }
Exemplo n.º 3
0
        public static bool Prefix(TextsDialog __instance, TextsDialog.TextInfo text)
        {
            if (TitleTextPrefab == null)
            {
                TextContainer = __instance.m_textAreaTopic.transform.parent;
                var textContainerBackground = TextContainer.gameObject.AddComponent <Image>();
                textContainerBackground.color         = new Color();
                textContainerBackground.raycastTarget = true;

                var verticalLayoutGroup = TextContainer.GetComponent <VerticalLayoutGroup>();
                verticalLayoutGroup.spacing = 0;

                TitleTextPrefab = Object.Instantiate(__instance.m_textAreaTopic, __instance.transform);
                TitleTextPrefab.gameObject.SetActive(false);
            }

            if (DescriptionTextPrefab == null)
            {
                DescriptionTextPrefab = Object.Instantiate(__instance.m_textArea, __instance.transform);
                DescriptionTextPrefab.gameObject.SetActive(false);
            }

            for (var i = 0; i < TextContainer.childCount; i++)
            {
                Object.Destroy(TextContainer.GetChild(i).gameObject);
            }

            var description = Object.Instantiate(TitleTextPrefab, TextContainer);

            description.gameObject.SetActive(true);
            description.text = text.m_topic;

            var parts = text.m_text.Split('\n');

            foreach (var part in parts)
            {
                var paragraphText = Object.Instantiate(DescriptionTextPrefab, TextContainer);
                paragraphText.gameObject.SetActive(true);
                paragraphText.text = part;
            }

            return(false);
        }
Exemplo n.º 4
0
 // Token: 0x06000657 RID: 1623 RVA: 0x00035AC7 File Offset: 0x00033CC7
 private void OnSelectText(TextsDialog.TextInfo text)
 {
     this.ShowText(text);
 }