Esempio n. 1
0
        public  void placeCharacter()
        {
            Character[] characters = new Character[5];
            for (int i = 0; i < 5; i++)
            {
                switch(heroType[i])
                {
                    case 0 :
                        {
                            characters[i] = new Character();
                            characters[i].Gender = gender[i];                         
                            characters[i].Herocharacter = hero_type[i];
                            characters[i].Name = hero_name[i];
                            Hero1class.Content = hero_type[0];
                            Hero2class.Content = hero_type[1];
                            Hero3class.Content = hero_type[2];
                            Hero4class.Content = hero_type[3];
                            Hero5class.Content = hero_type[4];
                            Hero1name.Content = hero_name[0];
                            Hero2name.Content = hero_name[1];
                            Hero3name.Content = hero_name[2];
                            Hero4name.Content = hero_name[3];
                            Hero5name.Content = hero_name[4];
                            break;
                        }
                    case 1 :
                        {
                            characters[i] = new Character();
                            characters[i].Gender = gender[i];
                            characters[i].Herocharacter = hero_type[i];
                            characters[i].Name = hero_name[i];
                            Hero1class.Content = hero_type[0];
                            Hero2class.Content = hero_type[1];
                            Hero3class.Content = hero_type[2];
                            Hero4class.Content = hero_type[3];
                            Hero5class.Content = hero_type[4];
                            Hero1name.Content = hero_name[0];
                            Hero2name.Content = hero_name[1];
                            Hero3name.Content = hero_name[2];
                            Hero4name.Content = hero_name[3];
                            Hero5name.Content = hero_name[4];
                            break;
                        }
                    case 2 :
                        {
                            characters[i] = new Character();
                            characters[i].Gender = gender[i];
                            characters[i].Herocharacter = hero_type[i];
                            characters[i].Name = hero_name[i];
                            Hero1class.Content = hero_type[0];
                            Hero2class.Content = hero_type[1];
                            Hero3class.Content = hero_type[2];
                            Hero4class.Content = hero_type[3];
                            Hero5class.Content = hero_type[4];
                            Hero1name.Content = hero_name[0];
                            Hero2name.Content = hero_name[1];
                            Hero3name.Content = hero_name[2];
                            Hero4name.Content = hero_name[3];
                            Hero5name.Content = hero_name[4];
                            break;
                        }
                    case 3 :
                        {
                            characters[i] = new Character();
                            characters[i].Gender = gender[i];
                            characters[i].Herocharacter = hero_type[i];
                            characters[i].Name = hero_name[i];
                            Hero1class.Content = hero_type[0];
                            Hero2class.Content = hero_type[1];
                            Hero3class.Content = hero_type[2];
                            Hero4class.Content = hero_type[3];
                            Hero5class.Content = hero_type[4];
                            Hero1name.Content = hero_name[0];
                            Hero2name.Content = hero_name[1];
                            Hero3name.Content = hero_name[2];
                            Hero4name.Content = hero_name[3];
                            Hero5name.Content = hero_name[4];
                            break;
                        }
                    case 4 :
                        {
                            characters[i] = new Character();
                            characters[i].Gender = gender[i];
                            characters[i].Herocharacter = hero_type[i];
                            characters[i].Name = hero_name[i];
                            Hero1class.Content = hero_type[0];
                            Hero2class.Content = hero_type[1];
                            Hero3class.Content = hero_type[2];
                            Hero4class.Content = hero_type[3];
                            Hero5class.Content = hero_type[4];
                            Hero1name.Content = hero_name[0];
                            Hero2name.Content = hero_name[1];
                            Hero3name.Content = hero_name[2];
                            Hero4name.Content = hero_name[3];
                            Hero5name.Content = hero_name[4];
                            break;
                        }
                  
                    default:
                            {
                                characters[i] = new Character();
                                characters[i] .Gender = gender[i];
                                characters[i].Herocharacter = hero_type[i];
                                characters[i].Name = hero_name[i];
                                Hero1class.Content = hero_type[0];
                                Hero2class.Content = hero_type[1];
                                Hero3class.Content = hero_type[2];
                                Hero4class.Content = hero_type[3];
                                Hero5class.Content = hero_type[4];
                                Hero1name.Content = hero_name[0];
                                Hero2name.Content = hero_name[1];
                                Hero3name.Content = hero_name[2];
                                Hero4name.Content = hero_name[3];
                                Hero5name.Content = hero_name[4];
                                break;
                            }
                       
                }
               MessageBox.Show("this is gender in index " + i +" "+ gender[i].ToString());
               MessageBox.Show("this is character in index " + i +" "+characters[i].Gender.ToString());
               MessageBox.Show("this name is in index " + i + " " + characters[i].Name.ToString());
               MessageBox.Show("this is in index " + i + " " + characters[i].ToString());
               MessageBox.Show("this is hero class in index" + " " + characters[i].Herocharacter.ToString());
            }

        }
Esempio n. 2
0
        public  void placeCharacter()
        {
            Character[] characters = new Character[5];
            for (int i = 0; i < 5; i++)
            {
                switch(heroType[i])
                {
                    case 0 :
                        {
                            characters[i] = new Character();
                            characters[i].Gender = gender[i];                         
                            characters[i].Herocharacter = hero_type[i];
                            characters[i].Name = hero_name[i];
                            Hero1class.Content = characters[i].Herocharacter;

                            Hero1name.Content = characters[i].Name;
                            
                           
                            break;
                        }
                    case 1 :
                        {
                            characters[i] = new Character();
                            characters[i].Gender = gender[i];
                            characters[i].Herocharacter = hero_type[i];
                            characters[i].Name = hero_name[i];

                            Hero2class.Content = characters[i].Herocharacter;
                            
                           
                            Hero2name.Content = characters[i].Name;
                            
                           
                            break;
                        }
                    case 2 :
                        {
                            characters[i] = new Character();
                            characters[i].Gender = gender[i];
                            characters[i].Herocharacter = hero_type[i];
                            characters[i].Name = hero_name[i];
                            Hero3class.Content = characters[i].Herocharacter;

                            Hero3name.Content = characters[i].Name;
                                                       
                            break;
                        }
                    case 3 :
                        {
                            characters[i] = new Character();
                            characters[i].Gender = gender[i];
                            characters[i].Herocharacter = hero_type[i];
                            characters[i].Name = hero_name[i];

                            Hero4class.Content = characters[i].Herocharacter;

                            Hero4name.Content = characters[i].Name;
                            
                           
                            break;
                        }
                    case 4 :
                        {
                            characters[i] = new Character();
                            characters[i].Gender = gender[i];
                            characters[i].Herocharacter = hero_type[i];
                            characters[i].Name = hero_name[i];
                            
                            Hero5class.Content = characters[i].Herocharacter;

                            Hero5name.Content = characters[i].Name;
                          
                            break;
                        }
                  
                    default:
                            {
                                /*
                                characters[i] = new Character();
                                characters[i] .Gender = gender[i];
                                characters[i].Herocharacter = hero_type[i];
                                characters[i].Name = hero_name[i];
                                Hero1class.Content = hero_type[0];
                                Hero2class.Content = hero_type[1];
                                Hero3class.Content = hero_type[2];
                                Hero4class.Content = hero_type[3];
                                Hero5class.Content = hero_type[4];
                                Hero1name.Content = hero_name[0];
                                Hero2name.Content = hero_name[1];
                                Hero3name.Content = hero_name[2];
                                Hero4name.Content = hero_name[3];
                                Hero5name.Content = hero_name[4];
                          */
                                break;
                            }
                       
                }
                /*
               MessageBox.Show("this is gender in index " + i +" "+ gender[i].ToString());
               MessageBox.Show("this is character in index " + i +" "+characters[i].Gender.ToString());

                //!!!!!!!!!! can't figure out where this null pointer exception is coming from. Help would be appreciated
               MessageBox.Show("this name is in index " + i + " " + characters[i].Name.ToString());
               MessageBox.Show("this is in index " + i + " " + characters[i].ToString());
               MessageBox.Show("this is hero class in index" + " " + characters[i].Herocharacter.ToString()); */
            }

        }