Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();
            //Sets the level/campus building's hoverOver status
            buildingSetUp();
            //Apply all five buttons to the MouseLeave event handler
            //When a the mouse leaves one of the five character buttons the button should be set to hidden
            btnCharacter1.MouseLeave += character_MouseLeave;
            btnCharacter2.MouseLeave += character_MouseLeave;
            btnCharacter3.MouseLeave += character_MouseLeave;
            btnCharacter4.MouseLeave += character_MouseLeave;
            btnCharacter5.MouseLeave += character_MouseLeave;

            //Fill in array of heroes with testers
            SoftwareEngineer    Cedric = new SoftwareEngineer("Cedric", true);
            NetworkArchitect    Malane = new NetworkArchitect("Malane", true);
            InformationSecurity Tom    = new InformationSecurity("Tom", true);
            SystemsAnalyst      Tyler  = new SystemsAnalyst("Tyler", true);
            SupportEngineer     Sandy  = new SupportEngineer("Sandy", false);

            chosenHeroes[0] = Malane;
            chosenHeroes[1] = Cedric;
            chosenHeroes[2] = Tom;
            chosenHeroes[3] = Tyler;
            chosenHeroes[4] = Sandy;
        }
Ejemplo n.º 2
0
        public void placeCharacter()
        {
            heroes = new Hero[5];
            for (int i = 0; i < 5; i++)
            {
                switch (job_type[i])
                {
                case "Software Engineer":
                {
                    heroes[i] = new SoftwareEngineer(hero_name[i], gender[i]);
                    break;
                }

                case "Support Engineer":
                {
                    heroes[i] = new SupportEngineer(hero_name[i], gender[i]);
                    break;
                }

                case "Systems Analyst":
                {
                    heroes[i] = new SystemsAnalyst(hero_name[i], gender[i]);
                    break;
                }

                case "Network Architect":
                {
                    heroes[i] = new NetworkArchitect(hero_name[i], gender[i]);
                    break;
                }

                case "Information Security":
                {
                    heroes[i] = new InformationSecurity(hero_name[i], gender[i]);
                    break;
                }

                default:
                {
                    break;
                }
                }
            }
            heroOneSlot.Source   = heroes[0].CharacterPortrait;
            heroTwoSlot.Source   = heroes[1].CharacterPortrait;
            heroThreeSlot.Source = heroes[2].CharacterPortrait;
            heroFourSlot.Source  = heroes[3].CharacterPortrait;
            heroFiveSlot.Source  = heroes[4].CharacterPortrait;

            nameLabelOne.Content   = heroes[0].Name;
            nameLabelTwo.Content   = heroes[1].Name;
            nameLabelThree.Content = heroes[2].Name;
            nameLabelFour.Content  = heroes[3].Name;
            nameLabelFive.Content  = heroes[4].Name;

            genderLabelOne.Content   = heroes[0].Male;
            genderLabelTwo.Content   = heroes[1].Male;
            genderLabelThree.Content = heroes[2].Male;
            genderLabelFour.Content  = heroes[3].Male;
            genderLabelFive.Content  = heroes[4].Male;

            jobLabelOne.Content   = heroes[0].JobRole;
            jobLabelTwo.Content   = heroes[1].JobRole;
            jobLabelThree.Content = heroes[2].JobRole;
            jobLabelFour.Content  = heroes[3].JobRole;
            jobLabelFive.Content  = heroes[4].JobRole;
        }
        private void AcceptButton_Click(object sender, RoutedEventArgs e)
        {
            tempName = NameBox.Text;

            if (!((tempName == "") || (tempName == "Enter Name.")))
            {
                switch (tempJobRole)
                {
                case "Software Engineer":
                {
                    heroes[heroSlot] = new SoftwareEngineer(tempName, tempGender);
                    break;
                }

                case "Support Engineer":
                {
                    heroes[heroSlot] = new SupportEngineer(tempName, tempGender);
                    break;
                }

                case "Systems Analyst":
                {
                    heroes[heroSlot] = new SystemsAnalyst(tempName, tempGender);
                    break;
                }

                case "Network Architect":
                {
                    heroes[heroSlot] = new NetworkArchitect(tempName, tempGender);
                    break;
                }

                case "Information Security":
                {
                    heroes[heroSlot] = new InformationSecurity(tempName, tempGender);
                    break;
                }

                default:
                {
                    break;
                }
                }
                if (Checker())
                {
                    confirmButtonSwitch();
                }
                CustomizeWindowGrid.Visibility = Visibility.Hidden;
                BlackOut.Visibility            = Visibility.Hidden;

                switch (heroSlot)
                {
                case 0:
                {
                    heroOneSlot.Source   = heroes[heroSlot].CharacterPortrait;
                    nameLabelOne.Content = heroes[heroSlot].Name;
                    jobLabelOne.Content  = heroes[heroSlot].JobRole;
                    if (heroes[heroSlot].Male)
                    {
                        genderLabelOne.Content = "Male";
                    }
                    else
                    {
                        genderLabelOne.Content = "Female";
                    }
                    break;
                }

                case 1:
                {
                    heroTwoSlot.Source   = heroes[heroSlot].CharacterPortrait;
                    nameLabelTwo.Content = heroes[heroSlot].Name;
                    jobLabelTwo.Content  = heroes[heroSlot].JobRole;
                    if (heroes[heroSlot].Male)
                    {
                        genderLabelTwo.Content = "Male";
                    }
                    else
                    {
                        genderLabelTwo.Content = "Female";
                    }
                    break;
                }

                case 2:
                {
                    heroThreeSlot.Source   = heroes[heroSlot].CharacterPortrait;
                    nameLabelThree.Content = heroes[heroSlot].Name;
                    jobLabelThree.Content  = heroes[heroSlot].JobRole;
                    if (heroes[heroSlot].Male)
                    {
                        genderLabelThree.Content = "Male";
                    }
                    else
                    {
                        genderLabelThree.Content = "Female";
                    }
                    break;
                }

                case 3:
                {
                    heroFourSlot.Source   = heroes[heroSlot].CharacterPortrait;
                    nameLabelFour.Content = heroes[heroSlot].Name;
                    jobLabelFour.Content  = heroes[heroSlot].JobRole;
                    if (heroes[heroSlot].Male)
                    {
                        genderLabelFour.Content = "Male";
                    }
                    else
                    {
                        genderLabelFour.Content = "Female";
                    }
                    break;
                }

                case 4:
                {
                    heroFiveSlot.Source   = heroes[heroSlot].CharacterPortrait;
                    nameLabelFive.Content = heroes[heroSlot].Name;
                    jobLabelFive.Content  = heroes[heroSlot].JobRole;
                    if (heroes[heroSlot].Male)
                    {
                        genderLabelFive.Content = "Male";
                    }
                    else
                    {
                        genderLabelFive.Content = "Female";
                    }
                    break;
                }

                default:
                {
                    break;
                }
                }
            }
            else
            {
                NameBox.Text = "Enter Name.";
            }
        }