Exemplo n.º 1
0
    public static bool ImportDisplay(RUISDisplay display, string filename, TextAsset displaySchema, bool loadFromFileInEditor)
    {
        XmlDocument xmlDoc = XMLUtil.LoadAndValidateXml(filename, displaySchema);

        if (xmlDoc == null)
        {
            return(false);
        }

        if (Application.isEditor && loadFromFileInEditor)
        {
            display.displayCenterPosition = XMLUtil.GetVector3FromXmlNode(xmlDoc.GetElementsByTagName("displayCenterPosition").Item(0));
            display.displayUpInternal     = XMLUtil.GetVector3FromXmlNode(xmlDoc.GetElementsByTagName("displayUp").Item(0));
            display.displayNormalInternal = XMLUtil.GetVector3FromXmlNode(xmlDoc.GetElementsByTagName("displayNormal").Item(0));
            display.width       = float.Parse(xmlDoc.GetElementsByTagName("displaySize").Item(0).Attributes["width"].Value);
            display.height      = float.Parse(xmlDoc.GetElementsByTagName("displaySize").Item(0).Attributes["height"].Value);
            display.resolutionX = int.Parse(xmlDoc.GetElementsByTagName("displayResolution").Item(0).Attributes["width"].Value);
            display.resolutionY = int.Parse(xmlDoc.GetElementsByTagName("displayResolution").Item(0).Attributes["height"].Value);
        }

        if (display.linkedCamera)
        {
            display.linkedCamera.LoadKeystoningFromXML(xmlDoc);
        }

        return(true);
    }