private void btnNewNpc_Click(object sender, EventArgs e)
        {
            var npc = new Npc();
            Npcs.Add(npc);

            LoadItems(lbxNpcs, Npcs);

            ClearDialogsTab();
        }
Esempio n. 2
0
        private void characterSelectionControl1_Click(object sender, EventArgs e)
        {
            int index = (int)(MouseNpcControlIndex.Y * npcSelectionControl1.Columns + MouseNpcControlIndex.X);

            if (Project.Npcs.Count > index)
            {
                cbbLayerType.SelectedIndex = (int)LayerType.ObjectLayer;

                enemySelectionControl1.SelectedIndex = -1;
                textureSelectionControl.SelectedTile = -1;
                objectSelectionControl1.SelectedIndex = -1;
                npcSelectionControl1.SelectedIndex = index;

                CurrentNpcId = Project.Npcs[index].Id;
                CurrentNpc = new Npc();
                CurrentNpc = Project.Npcs.Find(delegate(Npc o) { return o.Id == CurrentNpcId; });
            }
        }
        private void StartNpcInteraction(Npc npc)
        {
            if (npc.CurrentDialog != null)
            {
                npc.Face(Player);
                if (npc.CurrentDialog.Visible)
                {
                    npc.CurrentDialog.Close();
                    Game.Paused = false;

                    if (dialogs.Contains(npc.CurrentDialog))
                    {
                        dialogs.Remove(npc.CurrentDialog);
                    }
                }
                else
                {
                    Game.Paused = true;
                    npc.CurrentDialog.Show();
                    if (!dialogs.Contains(npc.CurrentDialog))
                    {
                        dialogs.Add(npc.CurrentDialog);
                    }
                }
            }
        }
        private void ProcessNpcDialogResponse(Npc npc, NpcDialog dialog, NpcDialogOption option)
        {
            // If the next dialog listed can be called
            bool canCallNextDialog = false;

            if (option.Function == NpcDialogOptionFunction.StartEvent)
            {
                canCallNextDialog = true;
                //ProcessMapEvent(Event.Load(option.EventId));
            }
            else if (option.Function == NpcDialogOptionFunction.StartQuest)
            {
                canCallNextDialog = true;
                Game.PlayerQuests.Add(Game.GameProject.Quests.Find(x => x.Id == option.EventId));
            }
            else if (option.Function == NpcDialogOptionFunction.ShowMarket)
            {
                canCallNextDialog = true;
            }
            else if (option.Function == NpcDialogOptionFunction.FinishQuest)
            {
                int questIndex = Game.PlayerQuests.FindIndex(x => x.Id == option.EventId);
                if (questIndex != -1)
                {
                    bool finishedQuest = CheckQuestStatus(Game.PlayerQuests[questIndex]);
                    canCallNextDialog = finishedQuest;

                    if (finishedQuest)
                    {
                        floatingText.Add(
                            new TextAnimation(LanguageConfig.Config.QuestFinished,
                                Player.Position,
                                Fonts.ArialBlack14, Color.LightGreen));
                        AddQuestAwards(Game.PlayerQuests[questIndex]);
                        Game.PlayerQuests[questIndex].State = QuestState.Completed;
                    }
                }
            }
            else if (option.Function == NpcDialogOptionFunction.SaveGame)
            {
                Game.SaveGame();
                canCallNextDialog = true;
            }

            if (canCallNextDialog)
            {
                if (option.NextDialogType == NextDialogType.ContinueConversation)
                {
                    dialog.NextDialog(option.NextDialog);

                    if (dialogs.Contains(npc.CurrentDialog))
                        dialogs.Remove(dialog);

                    dialog = npc.CurrentDialog;
                    dialog.Show();

                    if (!dialogs.Contains(dialog))
                        dialogs.Add(dialog);
                }
                else if (option.NextDialogType == NextDialogType.NewConversation)
                {
                    dialog.NextDialog(option.NextDialog);
                    Game.Paused = false;
                }
            }
            else
            {
                Game.Paused = false;
            }
        }
Esempio n. 5
0
 public NpcDialog(Npc owner, string message)
 {
     SetupVariables(owner, message);
 }
Esempio n. 6
0
        private void SetupVariables(Npc owner, string message)
        {
            font = Fonts.TrebuchetMS14;
            Text = message;

            if (owner != null)
            {
                Owner = owner;
                OwnerId = owner.Id;
            }

            Options = new List<NpcDialogOption>();
            Opacity = 255;
        }