private void NewResource_Click(object sender, RoutedEventArgs e)
        {
            RepoPC.UpdateAvailableResources();

            int before = RepoPC.ResourceList.Count;

            NewResource newResource = new NewResource();

            newResource.ShowDialog();

            RepoPC.UpdateAvailableResources();

            int after = RepoPC.ResourceList.Count;

            if (after == before + 1)
            {
                ResourceSelction.ItemsSource   = new string[] { "You Can't See Me" };
                ResourceSelction.ItemsSource   = RepoPC.ResourceNamesList;
                ResourceSelction.SelectedIndex = RepoPC.ResourceList.Count - 1;

                UpdateView();
            }
            else
            {
                MessageBox.Show("Resource Creation cancelled by User", "Message", MessageBoxButton.OK);
            }
        }
Exemple #2
0
        private void GoodExit_Click(object sender, RoutedEventArgs e)
        {
            if (EditMode.IsChecked == false)
            {
                Close();
            }
            else
            {
                try
                {
                    resource.Name         = Name.Text;
                    resource.MaxValue     = int.Parse(MaxValue.Text);
                    resource.MinValue     = int.Parse(MinValue.Text);
                    resource.MaxedAtStart = (bool)StartMaxed.IsChecked;

                    RepoPC.UpdateResource(resource);

                    Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Something went wrong - " + ex.Message, "Error", MessageBoxButton.OK);
                }
            }
        }
Exemple #3
0
        private Ability ShowAbility(Ability input)
        {
            Ability output = null;

            RepoPC.UpdateAvailableAbilities();
            int before = RepoPC.AbilitiesList.Count;

            ShowAbility showAbility = new ShowAbility();

            showAbility.Initialize(input);
            showAbility.ShowDialog();

            RepoPC.UpdateAvailableAbilities();
            int after = RepoPC.AbilitiesList.Count;

            try
            {
                if (after != before - 1)
                {
                    output = RepoPC.AbilitiesList.Find(x => x.ID == input.ID);
                }
            }
            catch (ArgumentNullException)
            {
            }

            return(output);
        }
        private void Create_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int id;
                if (RepoPC.ResourceList.Count == 0)
                {
                    id = 0;
                }
                else
                {
                    id = RepoPC.ResourceList.MaxBy(x => x.ID).ID + 1;
                }

                Resource dummy = new Resource()
                {
                    Name         = Name.Text,
                    MaxValue     = int.Parse(MaxValue.Text),
                    MinValue     = int.Parse(MinValue.Text),
                    MaxedAtStart = (bool)StartMaxed.IsChecked,
                    ID           = id
                };
                ReturnMessage result = RepoPC.NewResource(dummy);

                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong - " + ex.Message, "Error", MessageBoxButton.OK);
            }
        }
        private void ShowResource_Click(object sender, RoutedEventArgs e)
        {
            ShowResource show = new ShowResource();

            show.Initialize(RepoPC.ResourceList[ResourceSelction.SelectedIndex]);

            show.ShowDialog();
            RepoPC.UpdateAvailableResources();
        }
        private void TerribleExit_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Are you sure you want to delete this ability?", "Warning", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                RepoPC.DeleteAbility(ability);
                Close();
            }
        }
        public NewAbility()
        {
            InitializeComponent();

            RepoPC.UpdateAvailableResources();
            ResourceType.ItemsSource = RepoPC.ResourceNamesList;

            HaveActive.IsChecked = true;
            HaveEmpoweredOrAlternative.IsChecked = true;
            HavePassive.IsChecked = true;
        }
Exemple #8
0
        private void Create_Click(object sender, RoutedEventArgs e)
        {
            int id;

            if (RepoPC.ChampionList.Count == 0)
            {
                id = 0;
            }
            else
            {
                id = RepoPC.ChampionList.MaxBy(x => x.ID).ID + 1;
            }

            champ.ID                         = id;
            champ.Resource                   = RepoPC.ResourceList[ResourceType.SelectedIndex];
            champ.Name                       = Name.Text;
            champ.HealthStart                = Health.Text;
            champ.HealthGrowth               = HealthGrowth.Text;
            champ.HealthRegenStart           = HealthRegeneration.Text;
            champ.HealthRegenGrowth          = HealthRegenerationGrowth.Text;
            champ.ResourceStart              = Resource.Text;
            champ.ResourceGrowth             = ResourceGrowth.Text;
            champ.ResourceRegenStart         = ResourceRegeneration.Text;
            champ.ResourceRegenGrowth        = ResourceRegenerationGrowth.Text;
            champ.AttackDamageStart          = AttackDamage.Text;
            champ.AttackDamageGrowth         = AttackDamageGrowth.Text;
            champ.AbilityPowerStart          = AbilityPower.Text;
            champ.AbilityPowerGrowth         = AbilityPowerGrowth.Text;
            champ.AttackSpeedStart           = AttackSpeed.Text;
            champ.AttackSpeedGrowth          = AttackSpeedGrowth.Text;
            champ.RangeStart                 = Range.Text;
            champ.RangeGrowth                = RangeGrowth.Text;
            champ.CriticalStrikeChanceStart  = CriticalStrikeChance.Text;
            champ.CriticalStrikeChanceGrowth = CriticalStrikeChanceGrowth.Text;
            champ.ArmorStart                 = Armor.Text;
            champ.ArmorGrowth                = ArmorGrowth.Text;
            champ.MagicResistStart           = MagicResist.Text;
            champ.MagicResistGrowth          = MagicResistGrowth.Text;
            champ.MoveSpeedStart             = Movespeed.Text;
            champ.MoveSpeedGrowth            = MovespeedGrowth.Text;

            ReturnMessage result = RepoPC.NewChampion(champ);

            if (result.WasSuccesful == true)
            {
                Close();
            }
            else
            {
                MessageBox.Show(result.Message + " - " + result.Exception, "Warning", MessageBoxButton.OK);
            }
        }
Exemple #9
0
        public NewChampion()
        {
            InitializeComponent();
            RepoPC.UpdateAvailableResources();

            PassiveAbilityButton.Content = "New Ability";
            QAbilityButton.Content       = "New Ability";
            WAbilityButton.Content       = "New Ability";
            EAbilityButton.Content       = "New Ability";
            RAbilityButton.Content       = "New Ability";

            ResourceType.ItemsSource   = RepoPC.ResourceNamesList;
            ResourceType.SelectedIndex = 0;
        }
        public ShowAbility()
        {
            InitializeComponent();

            RepoPC.UpdateAvailableResources();
            ResourceType.ItemsSource = RepoPC.ResourceNamesList;

            GoodExit.Content        = "OK";
            BadExit.Visibility      = Visibility.Hidden;
            TerribleExit.Visibility = Visibility.Hidden;

            HaveActive.IsChecked = true;
            HaveEmpoweredOrAlternative.IsChecked = true;
            HavePassive.IsChecked = true;
        }
        private void Create_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int id;
                if (RepoPC.AbilitiesList.Count == 0)
                {
                    id = 0;
                }
                else
                {
                    id = RepoPC.AbilitiesList.MaxBy(x => x.ID).ID + 1;
                }

                Ability dummy = new Ability()
                {
                    Name         = AbilityName.Text,
                    ID           = id,
                    Slot         = Slot,
                    ResourceUse  = RepoPC.ResourceList[ResourceType.SelectedIndex],
                    HaveActive   = (bool)HaveActive.IsChecked,
                    IsToogleAble = (bool)IsToogleAble.IsChecked,
                    HaveEmpoweredOrAlternative = (bool)HaveEmpoweredOrAlternative.IsChecked,
                    HavePassive        = (bool)HavePassive.IsChecked,
                    DescriptionAct     = DescriptionAct.Text,
                    DamageAct          = DamageAct.Text,
                    CooldownAct        = CooldownAct.Text,
                    RangeAct           = RangeAct.Text,
                    ResourceCostAct    = ResourceCostAct.Text,
                    DescriptionEmpAlt  = DescriptionEmpAlt.Text,
                    DamageEmpAlt       = DamageEmpAlt.Text,
                    CooldownEmpAlt     = CooldownEmpAlt.Text,
                    RangeEmpAlt        = RangeEmpAlt.Text,
                    ResourceCostEmpAlt = ResourceCostEmpAlt.Text,
                    DescriptionPas     = DescriptionPas.Text,
                    RangePas           = RangePas.Text,
                    DamagePas          = DamagePas.Text,
                    CooldownPas        = CooldownPas.Text
                };
                ReturnMessage result = RepoPC.NewAbility(dummy);

                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong - " + ex.Message, "Error", MessageBoxButton.OK);
            }
        }
        public MainWindow()
        {
            InitializeComponent();

            List <ReturnMessage> messages = RepoPC.Initialize();

            ResourceSelction.ItemsSource = RepoPC.ResourceNamesList;
            AbilitySelction.ItemsSource  = RepoPC.AbilityNamesList;
            ChampionSelction.ItemsSource = RepoPC.ChampionNamesList;

            ResourceSelction.SelectedIndex = 0;
            AbilitySelction.SelectedIndex  = 0;
            ChampionSelction.SelectedIndex = 0;

            UpdateView();

            try
            {
                foreach (ReturnMessage mes in messages)
                {
                    if (mes.WasSuccesful == false)
                    {
                        throw new Exception();
                    }
                }
            }
            catch (Exception)
            {
                string warning = "Initialization of Database Handler failed \n" +
                                 "Restart program to try again \n" +
                                 "If this message have been shown multiple times, then contact program creator";

                MessageBox.Show(warning, "Warning", MessageBoxButton.OK);

                NewChampion.IsEnabled      = false;
                NewResource.IsEnabled      = false;
                ChampionSelction.IsEnabled = false;
                AbilitySelction.IsEnabled  = false;
                ResourceSelction.IsEnabled = false;
                ShowChampion.IsEnabled     = false;
                ShowAbility.IsEnabled      = false;
                ShowResource.IsEnabled     = false;
                DeleteChampion.IsEnabled   = false;
                DeleteResource.IsEnabled   = false;
            }
        }
        private void GoodExit_Click(object sender, RoutedEventArgs e)
        {
            if (EditMode.IsChecked == false)
            {
                Close();
            }
            else
            {
                try
                {
                    ability.Name         = AbilityName.Text;
                    ability.ResourceUse  = RepoPC.ResourceList[ResourceType.SelectedIndex];
                    ability.HaveActive   = (bool)HaveActive.IsChecked;
                    ability.IsToogleAble = (bool)IsToogleAble.IsChecked;
                    ability.HaveEmpoweredOrAlternative = (bool)HaveEmpoweredOrAlternative.IsChecked;
                    ability.HavePassive        = (bool)HavePassive.IsChecked;
                    ability.DescriptionAct     = DescriptionAct.Text;
                    ability.DamageAct          = DamageAct.Text;
                    ability.CooldownAct        = CooldownAct.Text;
                    ability.RangeAct           = RangeAct.Text;
                    ability.ResourceCostAct    = ResourceCostAct.Text;
                    ability.DescriptionEmpAlt  = DescriptionEmpAlt.Text;
                    ability.DamageEmpAlt       = DamageEmpAlt.Text;
                    ability.CooldownEmpAlt     = CooldownEmpAlt.Text;
                    ability.RangeEmpAlt        = RangeEmpAlt.Text;
                    ability.ResourceCostEmpAlt = ResourceCostEmpAlt.Text;
                    ability.DescriptionPas     = DescriptionPas.Text;
                    ability.RangePas           = RangePas.Text;
                    ability.DamagePas          = DamagePas.Text;
                    ability.CooldownPas        = CooldownPas.Text;

                    RepoPC.UpdateAbility(ability);

                    Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Something went wrong - " + ex.Message, "Error", MessageBoxButton.OK);
                }
            }
        }
        private void ShowAbility_Click(object sender, RoutedEventArgs e)
        {
            int before      = RepoPC.AbilitiesList.Count;
            int indexBefore = AbilitySelction.SelectedIndex;

            ShowAbility showAbility = new ShowAbility();

            showAbility.Initialize(RepoPC.AbilitiesList[indexBefore]);
            showAbility.ShowDialog();

            RepoPC.UpdateAvailableAbilities();
            int after = RepoPC.AbilitiesList.Count;

            if (after == before - 1)
            {
                AbilitySelction.ItemsSource   = new string[] { "You Can't See Me" };
                AbilitySelction.ItemsSource   = RepoPC.AbilityNamesList;
                AbilitySelction.SelectedIndex = indexBefore - 1;
            }
            UpdateView();
        }
Exemple #15
0
        private Ability NewAbility(LibRepo.AbilitySlot slot, int typeIndex)
        {
            Ability output = null;

            RepoPC.UpdateAvailableAbilities();
            int before = RepoPC.AbilitiesList.Count;

            NewAbility newAbility = new NewAbility();

            newAbility.Initialize(slot, typeIndex);
            newAbility.ShowDialog();

            RepoPC.UpdateAvailableAbilities();
            int after = RepoPC.AbilitiesList.Count;

            if (after == before + 1)
            {
                output = RepoPC.AbilitiesList.Last();
            }
            return(output);
        }
Exemple #16
0
        private void DeleteResource_Click(object sender, RoutedEventArgs e)
        {
            int indexBefore                = ResourceType.SelectedIndex;
            MessageBoxResult result        = MessageBox.Show("Are you sure you want to delete the selected Resource?", "Warning", MessageBoxButton.YesNo);
            ReturnMessage    returnMessage = null;

            try
            {
                if (result == MessageBoxResult.Yes)
                {
                    returnMessage            = RepoPC.DeleteResource(RepoPC.ResourceList[ResourceType.SelectedIndex]);
                    ResourceType.ItemsSource = new string[] { "You Can't See Me" };

                    RepoPC.UpdateAvailableResources();
                    ResourceType.ItemsSource   = RepoPC.ResourceNamesList;
                    ResourceType.SelectedIndex = indexBefore - 1;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong - " + ex.Message, "Error", MessageBoxButton.OK);
            }
        }
        private void DeleteChampion_Click(object sender, RoutedEventArgs e)
        {
            int indexBefore         = ChampionSelction.SelectedIndex;
            MessageBoxResult result = MessageBox.Show("Are you sure you want to delete the selected Champion?", "Warning", MessageBoxButton.YesNo);

            try
            {
                if (result == MessageBoxResult.Yes)
                {
                    RepoPC.DeleteChampion(RepoPC.ChampionList[indexBefore]);
                    ChampionSelction.ItemsSource = new string[] { "You Can't See Me" };

                    RepoPC.UpdateAvailableChampions();
                    ChampionSelction.ItemsSource   = RepoPC.ChampionNamesList;
                    ChampionSelction.SelectedIndex = indexBefore - 1;

                    UpdateView();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong - " + ex.Message, "Error", MessageBoxButton.OK);
            }
        }
 public NewResource()
 {
     InitializeComponent();
     RepoPC.UpdateAvailableResources();
 }