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


C# NPC.setDescriptions方法代码示例

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


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

示例1: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            resourcess = element.SelectNodes("resources"),
            descriptionss = element.SelectNodes("description"),
            assets,
            conditions,
            frontcolors,
            bordercolors,
            textcolors = element.SelectNodes("textcolor"),
            conversationsref = element.SelectNodes("conversation-ref"),
            voices = element.SelectNodes("voice"),
            actionss = element.SelectNodes("actions");

        string tmpArgVal;

        string characterId = element.GetAttribute("id");

        npc = new NPC(characterId);

        descriptions = new List<Description>();
        npc.setDescriptions(descriptions);

        if (element.SelectSingleNode("documentation") != null)
            npc.setDocumentation(element.SelectSingleNode("documentation").InnerText);

        foreach (XmlElement el in resourcess)
        {
            currentResources = new ResourcesUni();
            tmpArgVal = el.GetAttribute("name");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                currentResources.setName(el.GetAttribute(tmpArgVal));
            }

            assets = el.SelectNodes("asset");
            foreach (XmlElement ell in assets)
            {
                string type = "";
                string path = "";

                tmpArgVal = ell.GetAttribute("type");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    type = tmpArgVal;
                }
                tmpArgVal = ell.GetAttribute("uri");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    path = tmpArgVal;
                }
                currentResources.addAsset(type, path);
            }

            conditions = el.SelectNodes("condition");
            foreach (XmlElement ell in conditions)
            {
                currentConditions = new Conditions();
                new ConditionSubParser_(currentConditions, chapter).ParseElement(ell);
                currentResources.setConditions(currentConditions);
            }

            npc.addResources(currentResources);
        }

        foreach (XmlElement el in textcolors)
        {
            tmpArgVal = el.GetAttribute("showsSpeechBubble");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                npc.setShowsSpeechBubbles(tmpArgVal.Equals("yes"));
            }

            tmpArgVal = el.GetAttribute("bubbleBkgColor");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                npc.setBubbleBkgColor(tmpArgVal);
            }

            tmpArgVal = el.GetAttribute("bubbleBorderColor");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                npc.setBubbleBorderColor(tmpArgVal);
            }

            frontcolors = el.SelectNodes("frontcolor");
            foreach (XmlElement ell in frontcolors)
            {
                string color = "";

                tmpArgVal = ell.GetAttribute("color");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    color = tmpArgVal;
                }

                npc.setTextFrontColor(color);
            }

            bordercolors = el.SelectNodes("bordercolor");
//.........这里部分代码省略.........
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:101,代码来源:CharacterSubParser_.cs

示例2: startElement

    /*
     * (non-Javadoc)
     *
     * @see es.eucm.eadventure.engine.loader.subparsers.SubParser#startElement(java.lang.string, java.lang.string,
     *      java.lang.string, org.xml.sax.Attributes)
     */
    public override void startElement(string namespaceURI, string sName, string qName, Dictionary<string, string> attrs)
    {
        // If no element is being subparsed
        if (subParsing == SUBPARSING_NONE)
        {

            // If it is a character tag, store the id of the character
            if (qName.Equals("character"))
            {
                string characterId = "";

                foreach (KeyValuePair<string, string> entry in attrs)
                    if (entry.Key.Equals("id"))
                        characterId = entry.Value.ToString();

                npc = new NPC(characterId);

                descriptions = new List<Description>();
                npc.setDescriptions(descriptions);
            }

            // If it is a resources tag, create the new resources, and switch the element being parsed
            else if (qName.Equals("resources"))
            {
                currentResources = new ResourcesUni();

                foreach (KeyValuePair<string, string> entry in attrs)
                {
                    if (entry.Key.Equals("name"))
                        currentResources.setName(entry.Value.ToString());
                }

                reading = READING_RESOURCES;
            }

            // If it is an asset tag, read it and add it to the current resources
            else if (qName.Equals("asset"))
            {
                string type = "";
                string path = "";

                foreach (KeyValuePair<string, string> entry in attrs)
                {
                    if (entry.Key.Equals("type"))
                        type = entry.Value.ToString();
                    if (entry.Key.Equals("uri"))
                        path = entry.Value.ToString();
                }

                // If the asset is not an special one
                //if( !AssetsController.isAssetSpecial( path ) )
                currentResources.addAsset(type, path);
            }

            // If it is a frontcolor or bordercolor tag, pick the color
            else if (qName.Equals("frontcolor") || qName.Equals("bordercolor"))
            {
                string color = "";

                // Pick the color
                foreach (KeyValuePair<string, string> entry in attrs)
                    if (entry.Key.Equals("color"))
                        color = entry.Value.ToString();

                // Set the color in the npc
                if (qName.Equals("frontcolor"))
                    npc.setTextFrontColor(color);
                if (qName.Equals("bordercolor"))
                    npc.setTextBorderColor(color);
            }

            else if (qName.Equals("textcolor"))
            {
                foreach (KeyValuePair<string, string> entry in attrs)
                {
                    if (entry.Key.Equals("showsSpeechBubble"))
                        npc.setShowsSpeechBubbles(entry.Value.ToString().Equals("yes"));
                    if (entry.Key.Equals("bubbleBkgColor"))
                        npc.setBubbleBkgColor(entry.Value.ToString());
                    if (entry.Key.Equals("bubbleBorderColor"))
                        npc.setBubbleBorderColor(entry.Value.ToString());
                }
            }

            // If it is a conversation reference tag, store the destination id, and switch the element being parsed
            else if (qName.Equals("conversation-ref"))
            {
                string idTarget = "";

                foreach (KeyValuePair<string, string> entry in attrs)
                    if (entry.Key.Equals("idTarget"))
                        idTarget = entry.Value.ToString();

                conversationReference = new ConversationReference(idTarget);
//.........这里部分代码省略.........
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:101,代码来源:CharacterSubParser.cs


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