Пример #1
0
        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);
            Dialog = d;

            gameref.DialogScreen.CallDialog(this, (DialogCharacter)sender);

            //this.PhysicalContact -= FoundMe;
             * */
        }