当前位置: 首页>>代码示例>>C#>>正文


C# ConfigData.SetImageTarget方法代码示例

本文整理汇总了C#中ConfigData.SetImageTarget方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigData.SetImageTarget方法的具体用法?C# ConfigData.SetImageTarget怎么用?C# ConfigData.SetImageTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConfigData的用法示例。


在下文中一共展示了ConfigData.SetImageTarget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateDefaultDataSet

    // Create a default dataset for use in the editor.
    private ConfigData CreateDefaultDataSet()
    {
        ConfigData defaultDataSetData = new ConfigData();

        defaultDataSetData.SetImageTarget(CreateDefaultImageTarget(), QCARUtilities.GlobalVars.DEFAULT_TRACKABLE_NAME);
        defaultDataSetData.SetMultiTarget(CreateDefaultMultiTarget(), QCARUtilities.GlobalVars.DEFAULT_TRACKABLE_NAME);

        return defaultDataSetData;
    }
开发者ID:TopMR,项目名称:ARPrototype,代码行数:10,代码来源:ConfigDataManager.cs

示例2: CreateDataSetFromTrackables

    // This method creates a single data set from the trackables provided.
    // The method ignores the data set property in TrackableBehaviour and
    // adds all Trackables to a single file.
    // Default Trackables are not added to the data set.
    private ConfigData CreateDataSetFromTrackables(TrackableBehaviour[] trackables)
    {
        // Sanity check.
        if (trackables == null)
        {
            return null;
        }

        ConfigData sceneData = new ConfigData();

        foreach (TrackableBehaviour tb in trackables)
        {
            // Ignore non-data set trackables.
            if (!(tb is DataSetTrackableBehaviour))
            {
                continue;
            }

            IEditorDataSetTrackableBehaviour trackable = (DataSetTrackableBehaviour)tb;

            string dataSetName = trackable.DataSetName;
            string trackableName = trackable.TrackableName;

            // We ignore default Trackables or undefined Trackables.
            if (dataSetName == QCARUtilities.GlobalVars.DEFAULT_DATA_SET_NAME ||
                dataSetName == "" ||
                trackableName == QCARUtilities.GlobalVars.DEFAULT_TRACKABLE_NAME ||
                trackableName == "")
            {
                Debug.LogWarning("Ignoring default Trackable for export");
                continue;
            }

            if (trackable.GetType() == typeof(ImageTargetBehaviour))
            {
                ImageTargetBehaviour it = (ImageTargetBehaviour)trackable;
                IEditorImageTargetBehaviour editorIt = it;

                ConfigData.ImageTargetData itConfig = new ConfigData.ImageTargetData();

                itConfig.size = editorIt.GetSize();

                // Process Virtual Button list.
                VirtualButtonBehaviour[] vbs =
                    it.GetComponentsInChildren<VirtualButtonBehaviour>();
                itConfig.virtualButtons = new List<ConfigData.VirtualButtonData>(vbs.Length);
                foreach (VirtualButtonBehaviour vb in vbs)
                {
                    Vector2 leftTop;
                    Vector2 rightBottom;
                    if (!vb.CalculateButtonArea(out leftTop,
                                                out rightBottom))
                    {
                        // Invalid Button
                        continue;
                    }

                    ConfigData.VirtualButtonData vbConfig =
                        new ConfigData.VirtualButtonData();

                    IEditorVirtualButtonBehaviour editorVB = vb;
                    vbConfig.name = editorVB.VirtualButtonName;
                    vbConfig.enabled = editorVB.enabled;
                    vbConfig.rectangle = new Vector4(leftTop.x,
                                                        leftTop.y,
                                                        rightBottom.x,
                                                        rightBottom.y);
                    vbConfig.sensitivity = editorVB.SensitivitySetting;

                    itConfig.virtualButtons.Add(vbConfig);
                }

                sceneData.SetImageTarget(itConfig, editorIt.TrackableName);
            }
            else if (trackable.GetType() == typeof(MultiTargetBehaviour))
            {
                Debug.Log("Multi Targets not exported.");
            }
            else if (trackable.GetType() == typeof(CylinderTargetBehaviour))
            {
                Debug.Log("Cylinder Targets not exported.");
            }
        }

        return sceneData;
    }
开发者ID:carrizofm2010,项目名称:app012-acuariotribuno,代码行数:90,代码来源:SceneManager.cs

示例3: fileToStruct

    // This method takes a configData object and creates a config.xml file at
    // the given path out of it.
    public bool fileToStruct(string configXMLPath, ConfigData configData)
    {
        if (!File.Exists(configXMLPath))
            return false;

        using (XmlTextReader configReader = new XmlTextReader(configXMLPath))
        {
            while (configReader.Read())
            {
                if (configReader.NodeType == XmlNodeType.Element)
                {
                    // "Global" Attributes
                    string itNameAttr = "";

                    switch (configReader.Name)
                    {
                        case "ImageTarget":

                            // Parse name from config file
                            itNameAttr = configReader.GetAttribute("name");
                            if (itNameAttr == null)
                            {
                                Debug.LogWarning("Found ImageTarget without " +
                                                 "name attribute in " +
                                                 "config.xml. Image Target " +
                                                 "will be ignored.");
                                continue;
                            }

                            // Parse itSize from config file
                            Vector2 itSize = Vector2.zero;
                            string[] itSizeAttr =
                                configReader.GetAttribute("size").Split(' ');
                            if (itSizeAttr != null)
                            {
                                if (!QCARUtilities.SizeFromStringArray(
                                    out itSize, itSizeAttr))
                                {
                                    Debug.LogWarning("Found illegal itSize " +
                                                     "attribute for Image " +
                                                     "Target " + itNameAttr +
                                                     " in config.xml. " +
                                                     "Image Target will be " +
                                                     "ignored.");
                                    continue;
                                }
                            }
                            else
                            {
                                Debug.LogWarning("Image Target " + itNameAttr +
                                                 " is missing a itSize " +
                                                 "attribut in config.xml. " +
                                                 "Image Target will be " +
                                                 "ignored.");
                                continue;
                            }
                            configReader.MoveToElement();

                            ConfigData.ImageTarget imageTarget =
                                new ConfigData.ImageTarget();

                            imageTarget.size = itSize;
                            imageTarget.virtualButtons =
                                new List<ConfigData.VirtualButton>();

                            configData.SetImageTarget(imageTarget, itNameAttr);

                            break;

                        case "VirtualButton":

                            // Parse name from config file
                            string vbNameAttr =
                                configReader.GetAttribute("name");
                            if (vbNameAttr == null)
                            {
                                Debug.LogWarning("Found VirtualButton " +
                                                 "without name attribute in " +
                                                 "config.xml. Virtual Button " +
                                                 "will be ignored.");
                                continue;
                            }

                            // Parse rectangle from config file
                            Vector4 vbRectangle = Vector4.zero;
                            string[] vbRectangleAttr =
                                configReader.GetAttribute("rectangle").Split(' ');
                            if (vbRectangleAttr != null)
                            {
                                if (!QCARUtilities.RectangleFromStringArray(
                                    out vbRectangle, vbRectangleAttr))
                                {
                                    Debug.LogWarning("Found invalid " +
                                                     "rectangle attribute " +
                                                     "for Virtual Button " +
                                                     vbNameAttr +
                                                     " in config.xml. " +
                                                     "Virtual Button will " +
//.........这里部分代码省略.........
开发者ID:yonutix,项目名称:BattleTroops,代码行数:101,代码来源:ConfigParser.cs


注:本文中的ConfigData.SetImageTarget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。