示例#1
0
 private void AddAlternativeUI(AlternativeText alternative)
 {
     foreach (var item in alternativeComponents)
     {
         if (item.text.text == alternative.text)
         {
             return;
         }
     }
     size++;
     alternativeComponents[size - 1].text.text = alternative.text;
     SetVisiblityOfIndex(true, size - 1);
 }
    // We obtain automatically the text to be read when interacting with each element.
    public void GetInfoFromElements()
    {
        this.lengthOfElements = interactiveElements.Length;
        this.textToBeRead     = new string[lengthOfElements];
        this.highlights       = new GameObject[lengthOfElements];
        int count = 0;

        foreach (GameObject item in interactiveElements)
        {
            GameObject highlightGameObject = Instantiate(highlightPrefab) as GameObject;
            // we can't use parent = item.transform directly, we must use the
            // SetParent method with 'false'. If not, the scale, position and rotation of the
            // rect of the highlight screws up and is placed in the center of the world.
            highlightGameObject.transform.SetParent(item.transform, false);
            highlightGameObject.transform.SetAsFirstSibling();
            highlightGameObject.SetActive(false);

            highlights[count] = highlightGameObject;
            // object obj;
            AlternativeText altText = item.GetComponent <AlternativeText>();
            if (altText != null)
            {
                this.textToBeRead[count] = altText.altText;
                altText.panel            = this;
                altText.index            = count;
            }
            else
            {
                Text text;
                switch (item.tag)
                {
                case "Label":
                    text = item.transform.Find("Text").GetComponent <Text>();
                    this.textToBeRead[count] = "Etiqueta: " + text.text;
                    break;

                case "Button":
                    text = item.transform.Find("Text").GetComponent <Text>();
                    this.textToBeRead[count] = "Botón: " + text.text;
                    break;
                }
            }
            count++;
        }

        GameObject highlightToEnable = this.highlights[currentIndex];

        highlightToEnable.SetActive(true);
    }
    public AlternativeText Translated()
    {
        AlternativeText alternativeScenario2return;
        string          deviceLanguage = Application.systemLanguage.ToString();

        if (deviceLanguage == Japanese)
        {
            alternativeScenario2return = new AlternativeText(ja, hasFired);
        }
        else
        {
            alternativeScenario2return = new AlternativeText(en, hasFired);
        }

        return(alternativeScenario2return);
    }
示例#4
0
                public override int GetHashCode()
                {
                    int hash = 1;

                    hash ^= pictures_.GetHashCode();
                    if (AlternativeText.Length != 0)
                    {
                        hash ^= AlternativeText.GetHashCode();
                    }
                    if (AlternativeColor.Length != 0)
                    {
                        hash ^= AlternativeColor.GetHashCode();
                    }
                    if (_unknownFields != null)
                    {
                        hash ^= _unknownFields.GetHashCode();
                    }
                    return(hash);
                }
 public void SetAltText(string altText)
 {
     this.altText.altText = altText;
 }