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


C# Chapter.setDescription方法代码示例

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


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

示例1: Parse

    public void Parse(string path)
    {
        XmlDocument xmld = new XmlDocument ();

        string xml = "";
        switch (ResourceManager.Instance.getLoadingType ()) {
        case ResourceManager.LoadingType.RESOURCES_LOAD:
            directory = path.Split ('/') [0] + "/";
            if (path.Contains (".xml")) {
                path = path.Replace (".xml", "");
            }
            TextAsset ta = Resources.Load (path) as TextAsset;
            if (ta == null) {
                Debug.Log ("Can't load Descriptor file: " + path);
                return;
            } else
                xml = ta.text;
            break;
        case ResourceManager.LoadingType.SYSTEM_IO:
            xml = System.IO.File.ReadAllText(path);

            directory = "";
            string[] parts = path.Split ('/');

            for(int i = 0; i < parts.Length-1; i++)
                directory += parts[i] + "/";

            break;
        }

        xmld.LoadXml(xml);

        XmlElement element = xmld.DocumentElement
            ,descriptor     = (XmlElement) element.SelectSingleNode ("/game-descriptor")
            ,title          = (XmlElement) descriptor.SelectSingleNode ("title")
            ,description    = (XmlElement) descriptor.SelectSingleNode ("description")
            ,configuration  = (XmlElement) descriptor.SelectSingleNode ("configuration")
            ,contents       = (XmlElement) descriptor.SelectSingleNode ("contents");

        if (descriptor != null) {
            tmpString = descriptor.GetAttribute ("versionNumber");

            if (!string.IsNullOrEmpty(tmpString))
            {
                adventureData.setVersionNumber (tmpString);
            }
        }

        if (title != null) {
            tmpString = title.InnerText;

            if (!string.IsNullOrEmpty(tmpString))
            {
                adventureData.setTitle (tmpString);
            }
        }

        if (description != null) {
            tmpString = description.InnerText;

            if (!string.IsNullOrEmpty(tmpString))
            {
                adventureData.setDescription (tmpString);
            }
        }

        if (configuration != null)
        {
            tmpString = configuration.GetAttribute ("keepShowing");
            if (!string.IsNullOrEmpty(tmpString))
            {
                adventureData.setKeepShowing (tmpString.Equals("yes"));
            }

            tmpString = configuration.GetAttribute ("keyboard-navigation");
            if (!string.IsNullOrEmpty(tmpString))
            {
                adventureData.setKeyboardNavigation (tmpString.Equals("enabled"));
            }

            tmpString = configuration.GetAttribute ("defaultClickAction");
            if (!string.IsNullOrEmpty(tmpString))
            {
                if(tmpString.Equals("showDetails"))
                    adventureData.setDeafultClickAction(DescriptorData.DefaultClickAction.SHOW_DETAILS);
                else if(tmpString.Equals("showDetails"))
                    adventureData.setDeafultClickAction(DescriptorData.DefaultClickAction.SHOW_ACTIONS);
            }

            tmpString = configuration.GetAttribute ("perspective");
            if (!string.IsNullOrEmpty(tmpString))
            {
                if(tmpString.Equals("regular"))
                    adventureData.setPerspective(DescriptorData.Perspective.REGULAR);
                else if(tmpString.Equals("isometric"))
                    adventureData.setPerspective(DescriptorData.Perspective.ISOMETRIC);
            }

            tmpString = configuration.GetAttribute ("dragBehaviour");
            if (!string.IsNullOrEmpty(tmpString))
//.........这里部分代码省略.........
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:101,代码来源:AdventureHandler_.cs


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