예제 #1
0
        /// <summary>
        /// Code ajouté lors de la création d'une action
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListActions_ItemToCreate(object sender, EventArgs e)
        {
            VO_Action vNewItem = _Service.CreateAction();

            ListActions.AddItem(vNewItem.Id, vNewItem.Title);
            LoadAction(vNewItem.Id);
        }
예제 #2
0
        /// <summary>
        /// Charger actions
        /// </summary>
        public static void LoadActions()
        {
            _ActionSprites = new Dictionary <Guid, VO_AnimatedSprite[]>();

            foreach (VO_Action action in GameCore.Instance.Game.Actions)
            {
                VO_AnimatedSprite[] animItem = new VO_AnimatedSprite[3];
                if (action.InventoryIcon != Guid.Empty)
                {
                    animItem[0] = new VO_AnimatedSprite(action.InventoryIcon, new Guid(), Enums.AnimationType.IconAnimation, 0, 0, ViewerEnums.ImageResourceType.Permanent);
                }
                if (action.Icon != Guid.Empty)
                {
                    animItem[1] = new VO_AnimatedSprite(action.Icon, new Guid(), Enums.AnimationType.IconAnimation, 0, 0, ViewerEnums.ImageResourceType.Permanent);
                }
                if (action.ActiveIcon != Guid.Empty)
                {
                    animItem[2] = new VO_AnimatedSprite(action.ActiveIcon, new Guid(), Enums.AnimationType.IconAnimation, 0, 0, ViewerEnums.ImageResourceType.Permanent);
                }
                _ActionSprites.Add(action.Id, animItem);
                if (action.GoAction)
                {
                    _GoAction       = action;
                    _GoActionSprite = animItem;
                }
                else if (action.UseAction)
                {
                    _UseAction       = action;
                    _UseActionSprite = animItem;
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Insère une action
        /// </summary>
        /// <returns></returns>
        public static VO_Action CreateAction(Guid value)
        {
            //Création de l'objet
            int    i     = 1;
            string title = string.Empty;

            while (true)
            {
                if (GameCore.Instance.Game.Actions.Find(p => p.Title == string.Format(GlobalConstants.ACTION_NEW_ITEM, i)) != null)
                {
                    i++;
                    continue;
                }
                else
                {
                    title = string.Format(GlobalConstants.ACTION_NEW_ITEM, i);
                    break;
                }
            }

            VO_Action newItem = new VO_Action(value)
            {
                Title = title
            };

            //Insertion de l'objet
            GameCore.Instance.Game.Actions.Add(newItem);
            return(newItem);
        }
예제 #4
0
        /// <summary>
        /// Chargement d'un item
        /// </summary>
        /// <param name="guid"></param>
        private void LoadAction(Guid guid)
        {
            Cursor.Current = Cursors.WaitCursor;

            //Code de chargement
            CurrentAction = GameCore.Instance.GetActionById(guid);

            //Désactiver les eventhandler
            txtDescription.TextChanged -= new EventHandler(txtDescription_TextChanged);
            txtName.LostFocus          -= new EventHandler(txtName_TextChanged);

            //Afficher les groupes
            grpIcons.Visible        = true;
            grpInformations.Visible = true;

            if (CurrentAction.InventoryIcon != new Guid())
            {
                AnimInventory.LoadAnimation(CurrentAction.InventoryIcon);
                AnimInventory.Start();
            }
            else
            {
                AnimInventory.LoadAnimation(new Guid());
            }

            if (CurrentAction.Icon != new Guid())
            {
                AnimIcon.LoadAnimation(CurrentAction.Icon);
                AnimIcon.Start();
            }
            else
            {
                AnimIcon.LoadAnimation(new Guid());
            }

            if (CurrentAction.ActiveIcon != new Guid())
            {
                AnimActiveIcon.LoadAnimation(CurrentAction.ActiveIcon);
                AnimActiveIcon.Start();
            }
            else
            {
                AnimActiveIcon.LoadAnimation(new Guid());
            }


            //Bind des infos dans les contrôles
            txtDescription.Text = CurrentAction.Description;
            txtName.Text        = CurrentAction.Title;

            //Activer les eventhandler
            txtDescription.TextChanged += new EventHandler(txtDescription_TextChanged);
            txtName.LostFocus          += new EventHandler(txtName_TextChanged);

            Cursor.Current = DefaultCursor;
        }
예제 #5
0
        /// <summary>
        /// Récupère une nouvelle instance d'un item
        /// </summary>
        /// <param name="id">ID de l'action</param>
        /// <returns>VO_Action</returns>
        public VO_Action GetActionById(Guid id)
        {
            VO_Action action = Game.Actions.Find(p => p.Id == id);

            if (action != null)
            {
                return(action);
            }
            return((VO_Action)ValidationTools.CreateEmptyRessource(new VO_Action()));
        }
        /// <summary>
        /// Création d'un projet
        /// </summary>
        /// <param name="pProject">VO_Project</param>
        public void CreateProject(VO_Project project)
        {
            //Nouvelles données projet.
            GameCore.Instance.ResetGameCore();
            GameCore.Instance.Game.Project = project;
            GameCore.Instance.Game.Project.ProjectFileName    = project.Title;
            GameCore.Instance.Game.Project.Version            = GlobalConstants.PROJECT_VERSION;
            GameCore.Instance.Game.Project.BetaVersion        = GlobalConstants.BETA_VERSION;
            GameCore.Instance.Game.Project.RootPath           = project.RootPath += "\\" + ValidationTools.NormalizeFolderName(project.Title) + "\\";
            GameCore.Instance.Game.Project.MovementDirections = 4;

            //Création des dossiers du projet
            Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_MANUALS);
            Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES);
            Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_ANIMATIONS);
            Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_ANIMATIONS + "\\" + GlobalConstants.PROJECT_DIR_CHARACTERANIMATIONS);
            Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_ANIMATIONS + "\\" + GlobalConstants.PROJECT_DIR_CHARACTERFACES);
            Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_ANIMATIONS + "\\" + GlobalConstants.PROJECT_DIR_ICONS);
            Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_ANIMATIONS + "\\" + GlobalConstants.PROJECT_DIR_MENUS);
            Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_ANIMATIONS + "\\" + GlobalConstants.PROJECT_DIR_OBJECTANIMATIONS);
            Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_DECORS);
            //Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_FONTS);
            Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_LIFEBAR);
            Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_MUSICS);
            Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_SOUNDS);
            Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_SOUNDS + "\\" + GlobalConstants.PROJECT_DIR_VOICES);
            Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_SOUNDS + "\\" + GlobalConstants.PROJECT_DIR_EFFECTS);
            Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_GUIS);

            project.GameOverMusic = new VO_Music();
            project.MainMenuMusic = new VO_Music();
            project.GameOver      = ObjectsFactory.CreateScript(Enums.ScriptType.GameOverEvent);

            //Création de Map de base.
            EditorHelper.Instance.LastOrdinalLayer = 0;
            project.GameOver = ObjectsFactory.CreateScript(Enums.ScriptType.GameOverEvent);

            //Création de l'action "Aller"
            VO_Action go = ObjectsFactory.CreateAction(new Guid(GlobalConstants.ACTION_GO_ID));

            go.Title    = GlobalConstants.ACTION_GO;
            go.GoAction = true;

            //Création de l'action "Utiliser"
            VO_Action use = ObjectsFactory.CreateAction(new Guid(GlobalConstants.ACTION_USE_ID));

            use.Title     = GlobalConstants.ACTION_USE;
            use.UseAction = true;

            //Création des menus
            ObjectsFactory.CreateMenu();

            //Terminology
            ObjectsFactory.CreateTerminology();
        }
예제 #7
0
        /// <summary>
        /// Change d'action
        /// </summary>
        /// <param name="action">Id de l'action demandée</param>
        public static void SetCurrentAction(Guid action)
        {
            ItemAsAction = false;
            int x = (int)_CurrentActionSprite[0].Sprite.Position.X;
            int y = (int)_CurrentActionSprite[0].Sprite.Position.Y;

            _CurrentAction       = GameCore.Instance.GetActionById(action);
            _CurrentItem         = null;
            _CurrentActionSprite = _ActionSprites[action];
            SetPosition(x, y);
        }
예제 #8
0
 /// <summary>
 /// Mise à jour de l'action
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void EventManager_ActionSelectionChanged(object sender, EventArgs e)
 {
     if (ddpAction.ValueMember != null && ddpAction.ValueMember != string.Empty)
     {
         VO_Action CurrentAction = ddpAction.SelectedItem as VO_Action;
         if (CurrentAction != null)
         {
             CurrentEvent.PageList[PageIndex].ActionId = CurrentAction.Id;
         }
     }
 }
예제 #9
0
        /// <summary>
        /// Crée un item
        /// </summary>
        /// <returns>VO_Item</returns>
        public VO_Action CreateAction()
        {
            VO_Action action = null;

            RunServiceTask(delegate
            {
                action = _Business.CreateAction();
            }, Errors.ERROR_ACTION_STR_CREATE);

            return(action);
        }
예제 #10
0
        /// <summary>
        /// Change d'item
        /// </summary>
        /// <param name="item">Id de l'item demandé</param>
        public static void SetCurrentItem(Guid item)
        {
            ItemAsAction = true;
            ItemInUse    = item;
            int x = (int)_CurrentActionSprite[0].Sprite.Position.X;
            int y = (int)_CurrentActionSprite[0].Sprite.Position.Y;

            _CurrentAction       = _UseAction;
            _CurrentItem         = GameCore.Instance.GetItemById(item);
            _CurrentActionSprite = ItemManager.GetFullItem(item);
            SetPosition(x, y);
        }
예제 #11
0
 /// <summary>
 /// Survient lorsque le formulaire devient visible
 /// </summary>
 public void InitializeDBActions()
 {
     CurrentAction = null;
     ProvisionList();
     if (ListActions.DataSource.Count > 0)
     {
         Guid firstAction = ListActions.DataSource[0].Id;
         ListActions.SelectItem(firstAction);
         LoadAction(firstAction);
     }
     else
     {
         ListActions_ListIsEmpty(this, new EventArgs());
     }
 }
예제 #12
0
        /// <summary>
        /// Change d'action pour le go
        /// </summary>
        public static void SetCurrentActionToGo()
        {
            int x = 0;
            int y = 0;

            ItemAsAction = false;

            if (_CurrentActionSprite != null)
            {
                x = (int)_CurrentActionSprite[1].Sprite.Position.X;
                y = (int)_CurrentActionSprite[1].Sprite.Position.Y;
            }
            _CurrentItem         = null;
            _CurrentAction       = _GoAction;
            _CurrentActionSprite = _GoActionSprite;
            SetPosition(x, y);
        }
예제 #13
0
 /// <summary>
 /// Teste si un event est executable
 /// </summary>
 /// <param name="_event"></param>
 /// <returns></returns>
 public bool IsExecutablePage(VO_Page page)
 {
     //Si l'action ne correspond pas, on passe à la page suivante
     if (page.ActionActivated)
     {
         VO_Action action = GameCore.Instance.GetActionById(page.ActionId);
         if (action.Id == Guid.Empty || action.Id != ActionManager.CurrentAction.Id)
         {
             return(false);
         }
     }
     //Si l'item ne correspond pas, on passe à la page suivante
     if (page.ItemActivated)
     {
         VO_Item item = GameCore.Instance.GetItemById(page.ItemId);
         if (item.Id == Guid.Empty || item.Id != ActionManager.ItemInUse || !ActionManager.CurrentActionIsUse())
         {
             return(false);
         }
     }
     return(true);
 }
예제 #14
0
        /// <summary>
        /// Code ajouté lors de la suppression d'une action
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListActions_ItemToDelete(object sender, EventArgs e)
        {
            bool deletable = true;

            foreach (VO_Action action in GameCore.Instance.Game.Actions)
            {
                if ((action.Id == CurrentAction.Id && action.GoAction) || (action.Id == CurrentAction.Id && action.UseAction))
                {
                    deletable = false;
                }
            }

            if (!deletable)
            {
                MessageBox.Show(Errors.ERROR_ITEM_DELETION, Errors.ERROR_BOX_TITLE);
                ListActions.CancelDeletion = true;
            }
            else
            {
                CurrentAction.Delete();
                CurrentAction = null;
            }
        }
예제 #15
0
        public static bool CheckCurrentProjectIntegrity()
        {
            #region Check Event Stage Integrity

            ProjectValid = true;
            ErrorList    = new List <string>();

            #region Verification des nécessités de démarrage
            VO_Project           project   = GameCore.Instance.Game.Project;
            VO_PlayableCharacter character = GameCore.Instance.GetPlayableCharacterById(project.StartingCharacter);
            if (character == null)
            {
                ProjectValid = false;
                string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.STARTING_CHARACTER_NEEDED);
                ErrorList.Add(FormatedResult);
            }
            else
            {
                VO_Stage stage = GameCore.Instance.GetStageById(character.CoordsCharacter.Map);
                if (stage == null)
                {
                    ProjectValid = false;
                    string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.STARTING_STAGE_NEEDED);
                    ErrorList.Add(FormatedResult);
                }
            }
            if (string.IsNullOrEmpty(project.GuiResource))
            {
                ProjectValid = false;
                string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.GUI_SYSTEM_NEEDED);
                ErrorList.Add(FormatedResult);
            }
            #endregion

            #region Verification des GlobalEvents

            ErrorList.Add(Culture.Language.ProjectIntegrity.INTEGRITY_DATABASEZONE + "\r\n\r\n");

            foreach (VO_GlobalEvent CurrentEvent in GameCore.Instance.Game.GlobalEvents)
            {
                #region Verification des pages

                if (CurrentEvent.Script != null)
                {
                    if (EventScriptIntegrity(CurrentEvent.Script) == false)
                    {
                        ProjectValid = false;
                        string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.SCRIPT_GLOBALEVENT, CurrentEvent.Title);
                        ErrorList.Add(FormatedResult);
                    }
                }

                #endregion
            }

            #endregion

            #region Verification de GameOver

            VO_Script GameOverScript = project.GameOver;
            if (EventScriptIntegrity(GameOverScript) == false)
            {
                ProjectValid = false;
                string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.SCRIPT_GAMEOVER);
                ErrorList.Add(FormatedResult);
            }

            #endregion

            #region Verification des Items

            foreach (VO_Item CurrentItem in GameCore.Instance.Game.Items)
            {
                #region Verification des Action sur Item

                if (CurrentItem.Scripts != null)
                {
                    foreach (VO_ActionOnItemScript CurrentItemScript in CurrentItem.Scripts)
                    {
                        if (EventScriptIntegrity(CurrentItemScript.Script) == false)
                        {
                            VO_Action CurrentAction = GameCore.Instance.GetActionById(CurrentItemScript.Id);
                            ProjectValid = false;
                            string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.SCRIPT_ITEM, CurrentItem.Title, CurrentAction.Title);
                            ErrorList.Add(FormatedResult);
                        }
                    }
                }

                #endregion
            }

            #endregion

            #region Verification des ItemsInteraction

            foreach (VO_Script CurrentItemInteraction in GameCore.Instance.Game.InteractionScripts)
            {
                #region Verification de l'ItemInteraction

                if (CurrentItemInteraction != null)
                {
                    if (EventScriptIntegrity(CurrentItemInteraction) == false)
                    {
                        ProjectValid = false;
                        int            FoundItem       = 0;
                        List <VO_Item> AssociatedItems = new List <VO_Item>();
                        foreach (VO_Item CurrentItem in GameCore.Instance.Game.Items)
                        {
                            if (CurrentItem.ItemInteraction.Find(p => p.Script == CurrentItemInteraction.Id) != null)
                            {
                                AssociatedItems.Add(CurrentItem);
                                if (FoundItem == 2)
                                {
                                    break;
                                }
                                else
                                {
                                    FoundItem = FoundItem + 1;
                                }
                            }
                        }
                        string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.SCRIPT_ITEMINTERACTION, AssociatedItems[0].Title, AssociatedItems[1].Title);
                        ErrorList.Add(FormatedResult);
                    }
                }
                #endregion
            }

            #endregion

            #region Verification des Personnages de la Database

            List <VO_PlayableCharacter> PlayableCharacterList = GameCore.Instance.Game.PlayableCharacters;

            foreach (VO_PlayableCharacter CurrentPlayableCharacter in PlayableCharacterList)
            {
                if (ValidationTools.CheckMapExistence(CurrentPlayableCharacter.CoordsCharacter) == false)
                {
                    ProjectValid = false;
                    string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.CHECK_PLAYABLECHARACTER_MAP, CurrentPlayableCharacter.Title);
                    ErrorList.Add(FormatedResult);
                }
            }

            #endregion

            ErrorList.Add("\r\n\r\n" + Culture.Language.ProjectIntegrity.INTEGRITY_STAGE + "\r\n\r\n");

            List <VO_Base> StageList = GameCore.Instance.GetStages();
            foreach (VO_Stage CurrentStage in StageList)
            {
                #region Verification du Script de démarrage (Premiere fois)

                if (EventScriptIntegrity(CurrentStage.StartingFirstScript) == false)
                {
                    ProjectValid = false;
                    string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.STAGE_SCRIPT_START_FIRST, CurrentStage.Title);
                    ErrorList.Add(FormatedResult);
                }

                #endregion

                #region Verification du Script de démarrage

                if (EventScriptIntegrity(CurrentStage.StartingScript) == false)
                {
                    ProjectValid = false;
                    string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.STAGE_SCRIPT_START, CurrentStage.Title);
                    ErrorList.Add(FormatedResult);
                }

                #endregion

                #region Verification du Script de fin (Premiere fois)

                if (EventScriptIntegrity(CurrentStage.EndingFirstScript) == false)
                {
                    ProjectValid = false;
                    string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.STAGE_SCRIPT_END_FIRST, CurrentStage.Title);
                    ErrorList.Add(FormatedResult);
                }

                #endregion

                #region Verification du Script de fin

                if (EventScriptIntegrity(CurrentStage.EndingScript) == false)
                {
                    ProjectValid = false;
                    string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.STAGE_SCRIPT_END, CurrentStage.Title);
                    ErrorList.Add(FormatedResult);
                }

                #endregion

                #region Verification des Hotspot

                foreach (VO_StageHotSpot CurrentHotSpot in CurrentStage.ListHotSpots)
                {
                    #region Verification des pages

                    if (CurrentHotSpot.Event != null)
                    {
                        foreach (VO_Page CurrentPage in CurrentHotSpot.Event.PageList)
                        {
                            #region Verification du Script Courant

                            if (EventScriptIntegrity(CurrentPage.Script) == false)
                            {
                                ProjectValid = false;
                                string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.STAGE_SCRIPT_HOTSPOT, CurrentStage.Title, CurrentHotSpot.Title, CurrentPage.PageNumber + 1);
                                ErrorList.Add(FormatedResult);
                            }

                            #endregion
                        }
                    }

                    #endregion
                }

                #endregion

                #region Verification des Personnages

                foreach (VO_StageCharacter CurrentCharacter in CurrentStage.ListCharacters)
                {
                    #region Verification des pages

                    if (CurrentCharacter.Event != null)
                    {
                        foreach (VO_Page CurrentPage in CurrentCharacter.Event.PageList)
                        {
                            #region Verification du Script Courant

                            if (EventScriptIntegrity(CurrentPage.Script) == false)
                            {
                                ProjectValid = false;
                                string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.STAGE_SCRIPT_CHARACTER, CurrentStage.Title, CurrentCharacter.Title, CurrentPage.PageNumber + 1);
                                ErrorList.Add(FormatedResult);
                            }

                            #endregion
                        }
                    }

                    #endregion
                }

                #endregion

                #region Verification des Animation

                foreach (VO_Layer CurrentLayer in CurrentStage.ListLayers)
                {
                    #region Verification des pages

                    List <VO_StageAnimation> StageAnimationList = CurrentLayer.ListAnimations;

                    if (StageAnimationList != null)
                    {
                        foreach (VO_StageAnimation CurrentStageAnimation in StageAnimationList)
                        {
                            foreach (VO_Page CurrentPage in CurrentStageAnimation.Event.PageList)
                            {
                                #region Verification du Script Courant

                                if (EventScriptIntegrity(CurrentPage.Script) == false)
                                {
                                    ProjectValid = false;
                                    string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.SCRIPT_ANIMATION, CurrentStage.Title, CurrentLayer.Title, CurrentStageAnimation.Title, CurrentPage.PageNumber);
                                    ErrorList.Add(FormatedResult);
                                }

                                #endregion
                            }
                        }
                    }

                    #endregion
                }

                #endregion
            }

            #endregion

            return(ProjectValid);
        }