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


C# Choice.SetText方法代码示例

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


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

示例1: Temp

    Temp()
    {
        topic = new List<DialogueNode>();

        topic.Add(new DialogueLine(0, "Hello"));
        topic.Add(new DialogueLine(1, "Mornin'"));
        topic.Add(new DialogueLine(0, "Who stole the cookie from the cookie jar?"));
        topic.Add(new DialogueLine(1, "You stole the cookie from the cookie jar.")); // id = 3
        topic.Add(new DialogueLine(0, "Who me?"));
        topic.Add(new DialogueLine(1, "Yes, you!"));
        topic.Add(new DialogueLine(0, "Couldn't be!"));
        topic.Add(new DialogueLine(1, "Then who?"));

        DialogueChoice dc = new DialogueChoice();
        Choice c = new Choice();
        c.SetText("No idea.");
        c.AddOutcome(new OutcomeJump(3));
        dc.AddChoice(c);
        c = new Choice();
        c.AddOutcome(new OutcomeMood(0, -10));
        c.SetText("I lied, it was me actually."); // Choices CAN have no outcome, dialogue continues from next line
        dc.AddChoice(c);
        c = new Choice();
        c.AddOutcome(new OutcomeEnd());
        c.SetText("*Run Away*");
        dc.AddChoice(c);

        topic.Add(dc);

        topic.Add(new DialogueLine(1, "As expected, I'll be a master detective in no time."));
        topic.Add(new DialogueLine(0, "A master without cookies that is."));
    }
开发者ID:ChasmGamesProject,项目名称:UnityGameRepository,代码行数:32,代码来源:Temp.cs

示例2: ProcessChoiceOption

    private Choice ProcessChoiceOption()
    {
        Choice c = new Choice();
        string line;

        do
        {
            line = GetValidLine();
            if(line != null)
            {
                if(line[0] == '}')
                    break;
                else
                {
                    string[] elements = line.Split('=');
                    switch(elements[0].ToLower())
                    {
                    case "text":
                        c.SetText(elements[1]);
                        break;
                    case "outcome":
                        ChoiceOutcome co = ProcessChoiceOutcome(elements[1]);
                        if(co != null)
                            c.AddOutcome(co);
                        break;
                    }
                }
            }
        } while(line!=null);

        return c;
    }
开发者ID:ChasmGamesProject,项目名称:FinalUnityProject,代码行数:32,代码来源:LoadTopic.cs


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