Exemplo n.º 1
0
        // -------------------------------------------------------------------
        // Determine if the application we are hitting supports knowledge about the control's text implementation
        // -------------------------------------------------------------------
        private void TS_ScenarioPreConditions(bool requireTextPattern, CheckType checkType)
        {
            string className;
            string localizedControlType;

            // This is hard-coded as a critical failure
            if (m_le == null)
            {
                ThrowMe(CheckType.Verification, "Unable to get AutomationElement for control with focus");
            }

            // Give info about control
            TextLibrary.GetClassName(m_le, out className, out localizedControlType);
            Comment("Automation ID = " + m_le.Current.AutomationId.ToString() +
                    "           (" + className + " / " + localizedControlType + ")");

            try
            {
                _pattern = m_le.GetCurrentPattern(TextPattern.Pattern) as TextPattern;
            }
            catch (Exception exception)
            {
                if (Library.IsCriticalException(exception))
                {
                    throw;
                }

                Comment("Acquiring TextPattern for automation element with focus raised exception");
                Comment("  Message = " + exception.Message);
                Comment("  Type    = " + exception.GetType().ToString());
                ThrowMe(checkType, "Unable to proceed with test, should not have received exception acquiring TextPattern");  // hard-coded... on purpose
            }

            m_TestStep++;
        }
Exemplo n.º 2
0
 void Awake()
 {
     bgCanvas      = (Canvas)GameObject.Find("Canvas").GetComponent <Canvas>();
     renderCanvas  = (Canvas)GameObject.Find("SecondCanvas").GetComponent <Canvas>();
     defaultText   = (GameObject)Resources.Load("DefaultText");
     upperText     = (GameObject)Resources.Load("UpperText");
     fightSystem   = (GameObject)Resources.Load("FightManager");
     textLibrary   = scriptManager.GetComponent <TextLibrary>();
     choiceLibrary = scriptManager.GetComponent <ChoiceLibrary>();
 }
Exemplo n.º 3
0
    public string GetText(string key)
    {
        TextLibrary lib = m_fullLibrary[m_currentLanguage];

        if (lib == null)
        {
            return("");
        }

        return(lib.GetText(key));
    }
Exemplo n.º 4
0
    // Use this for initializations
    void Start()
    {
        int numFiles = m_languageFiles.Count;

        for (int i = 0; i < numFiles; ++i)
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(m_languageFiles[i].text);

            XmlNode mapNode = xmlDoc.GetElementsByTagName("text_library")[0];
            if (mapNode != null)
            {
                string code = mapNode.Attributes["code"].Value;
                m_languageCodes.Add(code);
                m_fullLibrary[code] = new TextLibrary();
                m_fullLibrary[code].LoadFromXML(mapNode, code);
            }
        }

        ChangeLanguage(m_languageCodes.Count > 0
            ? (m_languageCodes.Contains(m_defaultLanguageCode))? m_defaultLanguageCode : m_languageCodes[0]
            : "");
    }