Ejemplo n.º 1
0
        /// <summary>
        /// Renvoie une bad interaction
        /// </summary>
        /// <param name="eventSpot"></param>
        /// <param name="classId"></param>
        /// <returns></returns>
        private VO_Dialog FindBadInteraction(VO_Event eventSpot, Guid classId)
        {
            //Filtre go
            if (ActionManager.CurrentActionIsGo())
            {
                return(null);
            }

            VO_Class  _class       = GameCore.Instance.GetClassById(classId);
            VO_Dialog outputDialog = null;
            bool      isAll        = false;
            bool      isPartial    = false;

            if (_class == null)
            {
                return(null);
            }

            foreach (VO_BadInteraction badInteraction in _class.BadInteractions)
            {
                //Mauvaise action
                if (badInteraction.Action != Guid.Empty && ActionManager.CurrentAction.Id != badInteraction.Action)
                {
                    continue;
                }
                //Mauvais character
                if (badInteraction.Character != Guid.Empty && PlayableCharactersManager.CurrentPlayerCharacter.Id != badInteraction.Character)
                {
                    continue;
                }

                //Action Character
                if (badInteraction.Action == ActionManager.CurrentAction.Id && PlayableCharactersManager.CurrentPlayerCharacter.Id == badInteraction.Character)
                {
                    return(badInteraction.Dialog);
                }
                //Action ALL
                else if (!isPartial && badInteraction.Action == ActionManager.CurrentAction.Id && PlayableCharactersManager.CurrentPlayerCharacter.Id == Guid.Empty)
                {
                    isAll        = false;
                    isPartial    = true;
                    outputDialog = badInteraction.Dialog;
                }
                //ALL Character
                else if (!isPartial && badInteraction.Action == Guid.Empty && PlayableCharactersManager.CurrentPlayerCharacter.Id == badInteraction.Character)
                {
                    isAll        = false;
                    isPartial    = true;
                    outputDialog = badInteraction.Dialog;
                }
                //ALL ALL
                else if (!isAll && !isPartial && badInteraction.Action == Guid.Empty && badInteraction.Character == Guid.Empty)
                {
                    isAll        = true;
                    outputDialog = badInteraction.Dialog;
                }
            }
            return(outputDialog);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Charger la fenêtre de dialogue
        /// </summary>
        /// <param name="row">Ligne référence</param>
        private void LoadDialogPanel(DataGridViewRow row)
        {
            Guid      id     = (Guid)row.Cells[0].Value;
            VO_Dialog dialog = CurrentClass.BadInteractions.Find(p => p.Id == id).Dialog;

            FormsManager.Instance.DialogManager.FormClosed += new FormClosedEventHandler(DialogManager_FormClosed);
            FormsManager.Instance.DialogManager.LoadDialog(dialog.Clone(), Enums.ScriptType.ClassDialogs);
            FormsManager.Instance.DialogManager.ShowDialog(this);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Créateur de dialogues
        /// </summary>
        /// <returns></returns>
        public static VO_Dialog CreateDialog()
        {
            //Création de l'objet
            VO_Dialog dialog = new VO_Dialog()
            {
                Messages = new List <VO_Message>()
            };

            return(dialog);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Récupère les faces à afficher du dialogue en cours
        /// </summary>
        /// <param name="dialog">Dialog</param>
        /// <returns>Listes des faces</returns>
        public List <VO_AnimatedSprite> GetAnimatedFaces(VO_Dialog dialog)
        {
            List <VO_AnimatedSprite> list = null;

            RunServiceTask(delegate
            {
                list = _Business.GetAnimatedFaces(dialog);
            }, ViewerErrors.STAGE_LOAD_MENU, false, dialog.ToString());

            return(list);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Créateur de dialogues
        /// </summary>
        /// <returns></returns>
        public VO_Dialog CreateDialog()
        {
            VO_Dialog dialog = null;

            RunServiceTask(delegate
            {
                dialog = _Business.CreateDialog();
            }, Errors.ERROR_DIALOG_STR_CREATE);

            return(dialog);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Rafraichi les messages
        /// </summary>
        private void RefreshMessage(VO_RunningScript script)
        {
            if (script != null && script.CurrentLine != null && script.CurrentLine is VO_Script_Message)
            {
                VO_Dialog  dialog  = ((VO_Script_Message)script.CurrentLine).Dialog;
                VO_Message message = dialog.Messages[script.ObjectState - 1];
                Draw(_Service.FormatText(message, new VO_Size(_ProjectData.Resolution.Width, _ProjectData.Resolution.Height), new Point((int)Camera2D.Pos.X, (int)Camera2D.Pos.Y)));

                //Dessiner les faces
                if (dialog.UseFaces)
                {
                    Draw(_Service.GetAnimatedFaces(dialog));
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Test et gère les scripts
        /// </summary>
        /// <param name="stageObject"></param>
        /// <param name="IsProcess"></param>
        /// <returns></returns>
        public bool TestScript(VO_StageObject stageObject, Enums.TriggerEventConditionType type)
        {
            VO_Event eventSpot = stageObject.Event;
            VO_Page  _page     = null;

            //Activer l'event
            foreach (VO_Page page in eventSpot.PageList)
            {
                if (page.TriggerCondition == type && IsActivePage(page) && IsExecutablePage(page))
                {
                    _page = page;
                    break;
                }
            }

            //Bad Interactions
            if (type == Enums.TriggerEventConditionType.ClickEvent)
            {
                if (_page == null && eventSpot != null && stageObject.ClassId != Guid.Empty)
                {
                    VO_Dialog dialog = FindBadInteraction(eventSpot, stageObject.ClassId);
                    if (dialog != null)
                    {
                        VO_Script dynamicScript = new VO_Script(Guid.NewGuid());
                        dynamicScript.Lines = new List <VO_Line>();
                        VO_Script_Message scriptMessage = new VO_Script_Message();
                        scriptMessage.Id     = Guid.NewGuid();
                        scriptMessage.Dialog = dialog;
                        dynamicScript.Lines.Add(scriptMessage);
                        LaunchScript(stageObject, dynamicScript, type);
                        return(true);
                    }
                }
            }

            if (_page == null)
            {
                return(false);
            }

            #region Execute le script
            LaunchScript(stageObject, _page.Script, type);
            return(true);

            #endregion
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Récupère les faces à afficher du dialogue en cours
        /// </summary>
        /// <param name="dialog">Dialog</param>
        /// <returns>Listes des faces</returns>
        public List <VO_AnimatedSprite> GetAnimatedFaces(VO_Dialog dialog)
        {
            List <VO_AnimatedSprite> output = new List <VO_AnimatedSprite>();

            /*List<Guid> importedChars = new List<Guid>();
             * foreach (VO_Message mess in dialog.Messages)
             * {
             *  if (!importedChars.Contains(mess.Character) && mess.Character != Guid.Empty)
             *  {
             *      importedChars.Add(mess.Character);
             *      VO_CharacterSprite character = GetCharacterSprite(mess.Character);
             *      character.FaceAnim.SetPosition(character.FaceCoords.Location.X, character.FaceCoords.Location.Y);
             *      output.Add(character.FaceAnim);
             *  }
             * }*/
            //TODO FaceCoords
            return(output);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Chargement du dialogue
        /// </summary>
        /// <param name="dialog">VO_Dialog</param>
        public void LoadDialog(VO_Dialog dialog, Enums.ScriptType scriptType)
        {
            Cursor.Current = Cursors.WaitCursor;
            this.grdDialog.SuspendLayout();

            CurrentDialog   = dialog.Clone();
            CanceledChanges = false;

            _ScriptType = scriptType;
            if (scriptType == Enums.ScriptType.AnimationEvents ||
                scriptType == Enums.ScriptType.CharacterEvents ||
                scriptType == Enums.ScriptType.Events ||
                scriptType == Enums.ScriptType.StageEvents)
            {
                _UseCurrentStage = true;
            }
            else
            {
                _UseCurrentStage = false;
            }

            //Désactiver les eventhandlers
            grdDialog.CellValueChanged -= new DataGridViewCellEventHandler(grdDialog_CellValueChanged);
            grdDialog.CellClick        -= new DataGridViewCellEventHandler(grdDialog_CellClick);

            //Charger les listes
            LoadLists();

            chkShowFaces.Checked = CurrentDialog.UseFaces;

            //Charger la gridview
            grdDialog.Rows.Clear();
            foreach (VO_Message message in CurrentDialog.Messages)
            {
                InsertMessage(message);
            }

            //Activer les eventhandlers
            grdDialog.CellValueChanged += new DataGridViewCellEventHandler(grdDialog_CellValueChanged);
            grdDialog.CellClick        += new DataGridViewCellEventHandler(grdDialog_CellClick);

            this.grdDialog.ResumeLayout();
            Cursor.Current = DefaultCursor;
        }