void OnDialogInitiated(object sender, DialogueEventArgs args)
 {
     _currentDialogue   = args.dialoguePayload;
     _currentSlideIndex = 0;
     ShowSlide();
     GetComponent <Canvas>().enabled = true;
 }
Esempio n. 2
0
 void OnAnswerChoose(object sender, DialogueEventArgs dea)
 {
     if (dea.AnswerId == 0 && dea.NodeId == 0)
     {
         QuestTask task = QuestManager.GetTask("quest1", 0);
         task.IsDone = !task.IsDone;
     }
 }
Esempio n. 3
0
 void OnDialogInitiated(object sender, DialogueEventArgs args)
 {
     _currentDialogue   = args.dialogPayload;
     _currentSlideIndex = 0;
     ShowSlide();
     GetComponent <Canvas>().enabled   = true;
     _runtimeData.CurrentGameplayState = GameplayState.InDialog;
 }
Esempio n. 4
0
        public void OnChoice(DialogueEventArgs conv)
        {
            ConversationChoiceNode cast = (ConversationChoiceNode)conv.Data;

            MainWindow.logger.Log(cast.Question);

            for (int i = 0; i < cast.Nodes.Count; i++)
            {
                MainWindow.logger.Log(string.Format("[{0}] : {1}", i, cast.Choice[i]));
            }
        }
Esempio n. 5
0
        public void OnMessage(DialogueEventArgs conv)
        {
            ConversationTextNode cast = (ConversationTextNode)conv.Data;

            log.Trace("OnMessage Call");


            if (conv.NodeReady == 1 || conv.NodeReady == -1)
            {
                MainWindow.logger.Log("End of conversation!");
            }

            MainWindow.logger.Log(string.Format("'{0}' : {1}", cast.Subject.Name, cast.Text));
        }
Esempio n. 6
0
        public void OnStatement(DialogueEventArgs args)
        {
            log.Trace("OnStatement Call");

            if (args.Data is ConversationTextNode)
            {
                log.Info("Is Text Node");
            }
            else if (args.Data is ConversationChoiceNode)
            {
                log.Info("Is Choice Node");
            }
            else
            {
                log.Info("Is Statement");
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Creates a request for the Conversation to give next node
        /// </summary>
        /// <returns>A ResponseEntity</returns>
        public Response GetRequest()
        {
            DialogueEventArgs args = Engine.CurrentConversation.Next();

            if (args.NodeReady == 1)
            {
                return(new Response().WithCode(1).WithData(null));
            }

            if (args.IsSideNode)
            {
                Engine.OnSideNode(args);
            }


            switch (args.Data.NodeType)
            {
            case NodeType.DEFAULT:
                Engine.OnMessage(args);
                logger.Trace("TextNode Requested!");
                break;

            case NodeType.CHOICE:
                Engine.OnChoice(args);
                Engine.CurrentConversation.HasPrediction = true;
                logger.Trace("ChoiceNode Requested!");
                break;

            case NodeType.CONTEXT:
                Engine.OnStatement(args);
                Engine.CurrentConversation.HasPrediction = true;
                logger.Trace("ContextNode Requested!");
                break;

            default:
                break;
            }


            return(new Response().WithData(args.Data).WithCode(args.NodeReady));
        }
Esempio n. 8
0
        /// <summary>
        /// Creates a request for the Conversation to give previous node
        /// </summary>
        /// <returns>A ResponseEntity</returns>
        public Response BackRequest()
        {
            DialogueEventArgs args = Engine.CurrentConversation.Previous();


            if (args.NodeReady == -1)
            {
                return(new Response().WithCode(-1).WithData(null));
            }

            if (args.IsSideNode)
            {
                Engine.OnSideNode(args);
            }

            switch (args.Data.NodeType)
            {
            case NodeType.DEFAULT:
                Engine.OnMessage(args);
                break;

            case NodeType.CHOICE:
                Engine.OnChoice(args);
                Engine.OnSideNode(args);
                break;

            case NodeType.CONTEXT:
                Engine.OnStatement(args);
                break;

            default:
                break;
            }


            return(new Response().WithData(args.Data).WithCode(args.NodeReady));
        }
    void OnAnswerChoose(object sender, DialogueEventArgs dea)
    {
        if (dea.AnswerId == 0 && dea.NodeId == 0)
        {
            QuestManager.StartQuest("rk_quest");
            QuestManager.ShowQuestNote(_QUEST, 0);
            QuestManager.ShowQuestNote(_QUEST, 1);
            QuestManager.ShowQuestNote(_QUEST, 2);
            QuestTask task = QuestManager.GetTask(_QUEST, 0);
            task.IsVisible = true;
            task.IsDone    = true;
        }
        if (dea.AnswerId == 1 && dea.NodeId == 0)
        {
            QuestTask task = QuestManager.GetTask(_QUEST, 0);
            task.IsVisible           = true;
            StateControl.currentStep = StateControl.QUEST_STEP.FIRST_TALK_FINISHED;
            UnityEngine.SceneManagement.SceneManager.LoadScene(1);
        }
//        if (dea.AnswerId == 2 && dea.NodeId == 0)
//        {
//            QuestTask task = QuestManager.GetTask(_QUEST, 1);
//            task.IsVisible = true;
//            StateControl.currentStep = StateControl.QUEST_STEP.SECOND_TALK_FINISHED;
//            UnityEngine.SceneManagement.SceneManager.LoadScene (1);
//        }
//        if (dea.AnswerId == 3 && dea.NodeId == 0)
//        {
//            QuestTask task = QuestManager.GetTask(_QUEST, 0);
//            task.IsVisible = true;
//            StateControl.currentStep = StateControl.QUEST_STEP.THIRD_TALK_FINISHED;
//            UnityEngine.SceneManagement.SceneManager.LoadScene (2);
//
//
//        }
    }
 void ExitedDialogue(object sender, DialogueEventArgs e)
 {
     Game1.currentGameState = Game1.GameState.PLAY;
 }
Esempio n. 11
0
        public void ExitedDialogue(object sender, DialogueEventArgs e)
        {
            Console.WriteLine(e.exitNumber);

            switch (e.exitNumber)
            {
                case 0:
                    isInteracting = false;
                    dialogue.isTalking = false;
                    Game1.currentGameState = Game1.GameState.PLAY;
                    break;

                case 1:
                    attackPlayer = true;
                    break;

                case 2:
                    if (key != null)
                    {
                        key.position = Game1.character.positionRectangle;
                        Game1.keys.Add(key);
                        key = null;
                    }
                    if (quest != null)
                    {
                        quest.completed = true;
                    }
                    break;

                case 3:
                    if (name == "Ziva" && Game1.testBoss.health > 0)
                    {
                        Game1.testBoss.attackPlayer = true;
                    }
                    health = 0;
                    break;

                case 4:
                    if (sword != null)
                    {
                        Game1.character.GetSword(sword, game);
                    }
                    break;

                case 5:
                    if (secondDialogue != "null")
                    {
                        dialogue.dialogueManager = new DialogueManager(@"Content\npc\dialogue\" + secondDialogue + ".txt");
                        dialogue.dialogueManager.ReachedExit += ExitedDialogue;
                    }
                    break;

                case 6:
                    if (sword != null)
                    {
                        Game1.character.GetSword(sword, game);
                        sword = null;
                    }
                    if (secondDialogue != "null")
                    {
                        dialogue.dialogueManager = new DialogueManager(@"Content\npc\dialogue\" + secondDialogue + ".txt");
                        dialogue.dialogueManager.ReachedExit += ExitedDialogue;
                    }
                    break;
                case 7:
                    if (quest != null)
                    {
                        quest.Accept(game);
                    }
                    break;
                default:
                    isInteracting = false;
                    dialogue.isTalking = false;
                    Game1.currentGameState = Game1.GameState.PLAY;
                    break;
            }
        }
Esempio n. 12
0
 public void OnSideNode(DialogueEventArgs args)
 {
     log.Trace("OnSideNode Call");
 }
Esempio n. 13
0
 public void OnPlayerMessage(DialogueEventArgs conv)
 {
     log.Trace("OnPlayerMessage Call");
 }
Esempio n. 14
0
 public void OnNPCMessage(DialogueEventArgs conv, ISubject npc)
 {
     log.Trace("OnNPCMessage Call");
 }
Esempio n. 15
0
        private async Task SaveData(DialogueEventArgs args)
        {
            var    list   = new List <KeyValuePair <string, string> >();
            string res    = string.Empty;
            var    poster = new HttpDataPostSender();

            switch (_tmpActiveDataGrid.Name)
            {
            case "dgSensorRules":
                if (_selectedId > 0)
                {
                    list.Add(new KeyValuePair <string, string>("pr_id", _selectedId.ToString()));
                }
                list.Add(new KeyValuePair <string, string>("pr_cond", args.GetValue("tbCondition")));
                list.Add(new KeyValuePair <string, string>("pr_value", args.GetValue("tbValue")));
                list.Add(new KeyValuePair <string, string>("sens_id", args.GetValue("tbSensId")));
                list.Add(new KeyValuePair <string, string>("pr_text", args.GetValue("tbProblem")));
                list.Add(new KeyValuePair <string, string>("pr_bound_value", args.GetValue("tbBoundValue")));
                list.Add(new KeyValuePair <string, string>("pr_color", "r"));
                list.Add(new KeyValuePair <string, string>("pr_nn", args.GetValue("tbNumber")));
                list.Add(new KeyValuePair <string, string>("ap_id", ((ApparatusModel)treeObjects.SelectedNode.Tag).ap_id.ToString()));
                res = await poster.SendHttpPost(HttpApiRes.RulesPost, list, HttpApiRes.Host, HttpApiRes.Port);

                break;

            case "dgReason":
                if (_selectedId > 0)
                {
                    list.Add(new KeyValuePair <string, string>("rs_id", _selectedId.ToString()));
                }
                list.Add(new KeyValuePair <string, string>("pr_id", dgSensorRules.SelectedRows[0].Cells["colPrID"].Value.ToString()));
                list.Add(new KeyValuePair <string, string>("rs_text", args.GetValue("tbReason")));
                list.Add(new KeyValuePair <string, string>("rs_cond", args.GetValue("tbReasRule")));
                list.Add(new KeyValuePair <string, string>("rs_value", args.GetValue("tbReasValue")));
                list.Add(new KeyValuePair <string, string>("sens_id", args.GetValue("tbSensor")));
                list.Add(new KeyValuePair <string, string>("nn_rs", args.GetValue("tbReasNumber")));
                list.Add(new KeyValuePair <string, string>("rs_probability", args.GetValue("tbProb")));
                res = await poster.SendHttpPost(HttpApiRes.ReasonPost, list, HttpApiRes.Host, HttpApiRes.Port);

                break;

            case "dgSolution":
                if (_selectedId > 0)
                {
                    list.Add(new KeyValuePair <string, string>("sol_id", _selectedId.ToString()));
                }
                list.Add(new KeyValuePair <string, string>("rs_id", dgReason.SelectedRows[0].Cells["colReasID"].Value.ToString()));
                list.Add(new KeyValuePair <string, string>("sol_text", args.GetValue("tbSolution")));
                list.Add(new KeyValuePair <string, string>("sol_par", args.GetValue("tbParam")));
                list.Add(new KeyValuePair <string, string>("sens_id", args.GetValue("tbSolSensID")));
                list.Add(new KeyValuePair <string, string>("sol_nn", args.GetValue("tbSolNumber")));
                res = await poster.SendHttpPost(HttpApiRes.SolutionPost, list, HttpApiRes.Host, HttpApiRes.Port);

                break;
            }

            if (res == "200")
            {
                MessageBox.Show("Успешно");
            }
            else
            {
                MessageBox.Show($"Государь! Сервер пал... {res}");
            }
        }
Esempio n. 16
0
 private async void OnSubmitDialogue(DialogueEventArgs args)
 {
     await SaveData(args);
 }