Ejemplo n.º 1
0
        private void RemoveItemToBuild(object sender, RoutedEventArgs e)
        {
            // To access to the selected item we have to get the UcStatsItems that triggered this event
            Button       btn           = (Button)sender;
            Grid         grid          = (Grid)btn.Parent;
            UcStatsItems ucStatsParent = (UcStatsItems)grid.Parent;

            ActualBuild.RemoveItem(ucStatsParent.ActualItem);
            UcActualBuildStats.UpdateView();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Try to equip the selected item to the build
        /// </summary>
        private void EquipItemToBuild(object sender, RoutedEventArgs e)
        {
            // To access to the selected item we have to get the UcStatsItems that triggered this event
            Button       btn           = (Button)sender;
            Grid         grid          = (Grid)btn.Parent;
            UcStatsItems ucStatsParent = (UcStatsItems)grid.Parent;

            if (ucStatsParent.ActualItem.ConditionsRespected)
            {
                ucStatsParent.LblInfo.Content = String.Empty;

                // If it's not a ring, then we can try to equip it directly
                if (ucStatsParent.ActualItem.IdType != Build.ID_RING)
                {
                    if (!ActualBuild.EquipItem(ucStatsParent.ActualItem))
                    {
                        // TODO: show error message when the item can't be equiped
                    }
                }
                else
                {
                    // else we have to determine if the user want to equip the ring to the left or right hand
                    FrmChooseSideRing frmChooseSideRing = new FrmChooseSideRing(this);
                    frmChooseSideRing.ShowDialog();
                    if (InsertRingToLeft != null)
                    {
                        if (InsertRingToLeft == true)
                        {
                            ActualBuild.EquipRingLeft(ucStatsParent.ActualItem);
                        }
                        else
                        {
                            ActualBuild.EquipRingRight(ucStatsParent.ActualItem);
                        }
                    }
                }
                UcActualBuildStats.UpdateView();
            }
            else
            {
                ucStatsParent.LblInfo.Content = "Pas assez d'éléments sélectionnées.";
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Event that is triggered when we click on an image of the equipement
        /// </summary>
        private void Image_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Image         img  = (Image)sender;
            EnchantedItem item = new EnchantedItem();

            if (img.Tag != null)
            {
                item = ActualBuild.GetEquipedItemById((int)img.Tag);

                if (e.LeftButton == MouseButtonState.Pressed)
                {
                    // Left click, we load the item stats to the user control of stats
                    LoadItemsStatsToContent(item, true);
                }
                else if (e.RightButton == MouseButtonState.Pressed)
                {
                    // Right click, we load the item stats to a new modal of stats
                    CreateModalOfItemStats(item);
                }
            }
        }
Ejemplo n.º 4
0
 private void MenuReset_Click(object sender, RoutedEventArgs e)
 {
     ActualBuild.ResetBuild();
     UcActualBuildStats.UpdateView();
 }
Ejemplo n.º 5
0
 private void BtnRemoveAllItems_Click(object sender, RoutedEventArgs e)
 {
     // TODO: Add messagebox of confirmation
     ActualBuild.RemoveAllItem();
     UcActualBuildStats.UpdateView();
 }