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


C# Dialog.ToString方法代码示例

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


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

示例1: TalkToMe

        private void TalkToMe(Object sender, EventArgs e)
        {
            //((PlayerChar)sender).peopleFound++;
            //gameref.Network.ToString();

            //List<SocialGame> games = new List<SocialGame>();

            List<SocialGame> games = gameref.SocialSimStuff.games;  //List of games populated
            //TODO: Figure out how to initialize this games thing...

            /*TO JACK: Jack, I modified more further down.  The commented out code are your original lines*/

            KB_C CKB = gameref.SocialSimStuff.CKB;  //CKB has been initialized.  CKB is populated.
            KB_S SKB = gameref.SocialSimStuff.SKB;  //SKB has been initialized.  SKB is populated.
            SocialPair sp = gameref.Network.getPair(((BlankChar)sender).agent, this.agent); //INVALID CAST EXCEPTION!
            List<SocialGame> playableGames = gameref.Networks.getPlayableGames(sp, games);  //Retrieves the set of playable games.

            //END LIST

            Dialog d = new Dialog();
            //INITIAL DIALOG STATE:

            DialogState state = new DialogState(0, "Hi there.");

            for (int i = 0; Math.Abs(i) < playableGames.Count; i++)
            {
                state.addResponse(playableGames[Math.Abs(i)].gameType.SubjectName.ToString(), i+1);
            }
            //d.addState(state);
            for (int i = 0; Math.Abs(i) < playableGames.Count; i++)
            {
                List<String> spResponses = playableGames[i].getScript(sp);
                if (playableGames[i].gameType.SubjectName == SubjectType.Girl || playableGames[i].gameType.SubjectName == SubjectType.Mushrooms || playableGames[i].gameType.SubjectName == SubjectType.Cave || playableGames[i].gameType.SubjectName == SubjectType.Player)
                {
                    //Subjects: NPC starts dialog. Player, Girl, Mushrooms, Cave
                    //state = new DialogState(0, spResponses[0]);
                    for (int j = 0; j < spResponses.Count; j += 2) //0 = initial statement, 1 = first response. and so on...
                    {
                        d.addState(state);
                        state = new DialogState(i + 1 + j * 20, spResponses[j]);
                        if (spResponses.Count > j + 2)
                            state.addResponse(spResponses[j + 1], i + 1 + (j + 1 ) * 20);
                        else
                            state.addResponse(spResponses[j + 1], i + 1 * -1);
                    }
                }
                else
                {
                    d.addState(state);
                    state = new DialogState(i + 1 , "");
                    for (int j = 0; j < spResponses.Count; j += 2) //0 = initial statement, 1 = first response. and so on...
                    {
                        //state = new DialogState(i + 1 + j * 20, spResponses[j]);
                        if (spResponses.Count > j + 1)
                        {
                            state.addResponse(spResponses[j], i + 1 + (j + 1) * 20);
                            d.addState(state);
                            state = new DialogState(i + 1 + (j + 1) * 20, spResponses[j + 1]);
                        }
                        else
                            state.addResponse(spResponses[j], i + 1 * -1);
                    }
                }
            }
            /*for( int i =  0 ; Math.Abs(i) > games.Count ; i-- )
            {
                state.addResponse(games[i].gameType.SubjectName.ToString(), i);
                //Adds responses based on game
            }*/
            d.addState(state);
            Dialog = d;
            Console.WriteLine(d.ToString());
            gameref.DialogScreen.CallDialog(this, (DialogCharacter)sender);

            //Doesnt Return a String....

            //sp.playGame(games[Math.Abs(d.currentID)], CKB.getTopic(games[Math.Abs(d.currentID)].gameType).Name);    //ONLY modifies values based on algorithm.

            sp.playGame(playableGames[Math.Abs(this.lastDialogEventNum)], CKB.getTopic(playableGames[Math.Abs(this.lastDialogEventNum)].gameType).Name);    //ONLY modifies values based on algorithm.

            //Assuming a Array of Strings, in the order NPC action, then. Player Dialog Options.

               /* String[] spResponses = new String[2];
            state = new DialogState(0,spResponses[0]);
            for (int i = 1; i > spResponses.Length; i++)
            {
                state.addResponse(spResponses[i]);
            }
            */
            /*
            //Subjects: NPC starts dialog. Player, Girl, Mushrooms, Cave
            List<String> spResponses = playableGames[Math.Abs(d.currentID)].getScript(sp);
            state = new DialogState(0, spResponses[0]);
            for (int i = 1; i < spResponses.Count; i++) //0 = initial statement, 1 = first response. and so on...
            {
                state.addResponse(spResponses[i]);
            }

            d = new Dialog();
            d.addState(state);
//.........这里部分代码省略.........
开发者ID:Kurios,项目名称:4803AIGame,代码行数:101,代码来源:BlankChar.cs


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