Beispiel #1
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;
        }
Beispiel #2
0
        /// <summary>
        /// Chargement d'un item
        /// </summary>
        /// <param name="guid"></param>
        private void LoadItem(Guid guid)
        {
            Cursor.Current = Cursors.WaitCursor;

            //Code de chargement
            CurrentItem = GameCore.Instance.GetItemById(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;
            grpView.Visible         = true;

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

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

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


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

            //Bind des actions
            listActions.Items.Clear();
            foreach (VO_Base action in GameCore.Instance.Game.Actions)
            {
                if (!((VO_Action)action).GoAction && !((VO_Action)action).UseAction)
                {
                    listActions.Items.Add(action);
                }
            }
            listActions.DisplayMember = "Title";
            listActions.ValueMember   = "Id";
            if (listActions.Items.Count > 0)
            {
                listActions.SelectedIndex = 0;
            }

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

            Cursor.Current = DefaultCursor;
        }