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


C# Conversation.exec方法代码示例

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


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

示例1: PlayConversation


//.........这里部分代码省略.........
                            }
                            else if (effectNodeName == "trigger-scene")
                            {
                                TriggerSceneEffect eff = new TriggerSceneEffect();
                                eff.idTarget = effectNode.Attributes["idTarget"].Value;
                                dialogNodeModel.effects[m] = eff;
                                ++m;
                            }
                            else if (effectNodeName == "trigger-cutscene")
                            {
                                TriggerCutSceneEffect eff = new TriggerCutSceneEffect();
                                eff.idTarget = effectNode.Attributes["idTarget"].Value;
                                dialogNodeModel.effects[m] = eff;
                                ++m;

                            }
                            else if (effectNodeName == "condition")
                            {
                                Condition conditionModel = new Condition();

                                XmlNodeList activesList = effectNode.SelectNodes("active");
                                conditionModel.actives = new string[activesList.Count];
                                for (int y = 0; y < activesList.Count; y++)
                                {
                                    conditionModel.actives[y] = activesList[y].Attributes["flag"].Value;
                                }

                                XmlNodeList inactivesList = effectNode.SelectNodes("inactive");
                                conditionModel.inactives = new string[inactivesList.Count];
                                for (int y = 0; y < inactivesList.Count; y++)
                                {
                                    conditionModel.inactives[y] = inactivesList[y].Attributes["flag"].Value;
                                }

                                dialogNodeModel.effects[m - 1].condition = conditionModel;
                            }
                        }

                    }
                }

                nodeModel = dialogNodeModel;
            }
            else if (name == "option-node")
            {
                OptionNode optionNodeModel = new OptionNode();
                XmlAttribute randomAttr = node.Attributes["random"];
                if (randomAttr != null && randomAttr.Value == "yes")
                {
                    optionNodeModel.isRandom = true;
                }
                XmlNodeList optionSpeaks = node.SelectNodes("*");

                optionNodeModel.options = new Option[node.SelectNodes("speak-player").Count];
                int z = 0;

                for (int j = 0; j < optionSpeaks.Count; ++j)
                {
                    XmlNode optionNode = optionSpeaks[j];
                    string optionName = optionNode.Name;
                    if (optionName == "speak-player")
                    {
                        Option speakModel = new Option();
                        speakModel.text = optionNode.InnerText;
                        optionNodeModel.options[z] = speakModel;
                        ++z;
                    }
                    else if (optionName == "condition")
                    {
                        Condition conditionModel = new Condition();

                        XmlNodeList activesList = optionNode.SelectNodes("active");
                        conditionModel.actives = new string[activesList.Count];
                        for (int y = 0; y < activesList.Count; y++)
                        {
                            conditionModel.actives[y] = activesList[y].Attributes["flag"].Value;
                        }

                        XmlNodeList inactivesList = optionNode.SelectNodes("inactive");
                        conditionModel.inactives = new string[inactivesList.Count];
                        for (int y = 0; y < inactivesList.Count; y++)
                        {
                            conditionModel.inactives[y] = inactivesList[y].Attributes["flag"].Value;
                        }

                        optionNodeModel.options[z - 1].condition = conditionModel;
                    }
                    else if (optionName == "child")
                    {
                        optionNodeModel.options[z - 1].nextIndex = Utils.IntParseFast(optionNode.Attributes["nodeindex"].Value);
                    }
                }

                nodeModel = optionNodeModel;
            }

            convModel.nodes[i] = nodeModel;
        }
        convModel.exec();
    }
开发者ID:RotaruDan,项目名称:firstaidgame,代码行数:101,代码来源:Conversations.cs


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