Exemplo n.º 1
0
        public Heidi(int id)
            : base(id)
        {
            Texture = "heidi.png";
            Name = "Heidi";
            Icon = "heidiicon.png";

            OnInteract = DoInteract;

            // Einstiegssatz
            dialog = new Dialog()
            {
                Message = "Hallo junger Held.",
                CanExit = true,
            };

            // Option 1
            dialog.Options.Add(new Dialog()
                { 
                    Option = "Erzaehl mal was ueber das Dorf",
                    Message = "Hier war alles friedlich bis zuletzt. Jetzt haben wir Orcs hier.",
                    Back = dialog,
                });

            // Option 2 (vor dem Quest)
            dialog.Options.Add(before = new Dialog()
                {
                    Option = "Kann ich was tun?",
                    Message = "Ja bitte. Mir wurde meine goldene Muenze geraubt.",
                    Back = dialog,
                    OnShow = (game, item) =>
                    {
                        // Questfortschritt setzen
                        game.Simulation.SetQuestProgress("Heidis Quest", "search");
                        before.Visible = false;
                    }
                });

            dialog.Options.Add(after = new Dialog()
                {
                    Option = "Hier ist deine Muenze",
                    Message = "Wow! Ich und das Dorf werden dir das nicht vergessen! *schmatz*",
                    Back = dialog,
                    OnShow = (game, item) =>
                    {
                        // Questgegenstand entfernen
                        Player player = item as Player;
                        var coin = player.Inventory.SingleOrDefault(i => i is GoldenCoin);
                        if (coin != null)
                            game.Simulation.Transfer(coin, player, null);

                        // Quest Fortschritt auf Success 
                        game.Simulation.SetQuestSuccess("Heidis Quest", "success");
                        after.Visible = false;
                    }
                });
        }
Exemplo n.º 2
0
        public DialogScreen(ScreenComponent manager, Item speaker, Player player, Dialog entry) 
            : base(manager)
        {
            this.speaker = speaker;
            this.player = player;
            current = entry;

            Controls.Add(new Icon(manager) { Position = new Rectangle(10, 10, 24, 24), Texture = speaker.Icon });
            Controls.Add(message = new Label(manager) { Position = new Rectangle(40, 10, manager.GraphicsDevice.Viewport.Width - 50, 30) });
            Controls.Add(list = new DialogList(manager) { });

            list.OnInteract += OnInteract;

            Refill();
        }
Exemplo n.º 3
0
 private void OnInteract(ListItem item)
 {
     Dialog dialog = item.Tag as Dialog;
     if (dialog != null)
     {
         // Auswahl einer Dialog-Option
         current = dialog;
         Refill();
     }
     else
     {
         // Beenden-Eitnrag ausgewählt
         Manager.CloseScreen();
     }
 }