コード例 #1
0
ファイル: GamePage.xaml.cs プロジェクト: jav1dan/Melomash
 public void load_artist(int artist_indexer)
 {
     started_to_type = false;
     tmp_art = core.sorted[artist_indexer];
     artist_index = artist_indexer;
     b1.Visibility = Visibility.Visible;
     b2.Visibility = Visibility.Visible;
     b3.Visibility = Visibility.Visible;
     b4.Visibility = Visibility.Visible;
     b5.Visibility = Visibility.Visible;
     b6.Visibility = Visibility.Visible;
     b7.Visibility = Visibility.Visible;
     b8.Visibility = Visibility.Visible;
     b9.Visibility = Visibility.Visible;
     b10.Visibility = Visibility.Visible;
     b11.Visibility = Visibility.Visible;
     b12.Visibility = Visibility.Visible;
     b13.Visibility = Visibility.Visible;
     b14.Visibility = Visibility.Visible;
     b15.Visibility = Visibility.Visible;
     word1.Visibility = Visibility.Visible;
     word2.Visibility = Visibility.Visible;
     word3.Visibility = Visibility.Visible;
     if (tmp_art.song1.Length > 0)
     {
         song1.Visibility = Visibility.Visible;
     }
     else
     {
         song1.Visibility = Visibility.Collapsed;
     }
     if (tmp_art.song2.Length > 0)
     {
         song2.Visibility = Visibility.Visible;
     }
     else
     {
         song2.Visibility = Visibility.Collapsed;
     }
     if (tmp_art.song3.Length > 0)
     {
         song3.Visibility = Visibility.Visible;
     }
     else
     {
         song3.Visibility = Visibility.Collapsed;
     }
     timing.Begin();
     switch (core.main_level.tracks_count)
     {
         case "1":
             play1.SetValue(Grid.ColumnProperty, 2);
             play2.Visibility = Visibility.Collapsed;
             play3.Visibility = Visibility.Collapsed;
             break;
         case "2":
             play1.Visibility = Visibility.Visible;
             play2.Visibility = Visibility.Visible;
             play3.Visibility = Visibility.Collapsed;
             break;
         case "3":
             play1.Visibility = Visibility.Visible;
             play2.Visibility = Visibility.Visible;
             play3.Visibility = Visibility.Visible;
             if (core.third_track_is_avail(core.makeArtistWord(tmp_art)))
             {
                 play3.Source = play2.Source;
             }
             else
             {
                 play3.Source = new BitmapImage(new Uri("/Assets/playbutton_inactive.png", UriKind.Relative));
             }
             break;
         default:
             play1.Visibility = Visibility.Visible;
             play2.Visibility = Visibility.Visible;
             play3.Visibility = Visibility.Visible;
             if (core.third_track_is_avail(core.makeArtistWord(tmp_art)))
             {
                 play3.Source = play2.Source;
             }
             else
             {
                 play3.Source = new BitmapImage(new Uri("/Assets/playbutton_inactive.png", UriKind.Relative));
             }
             break;
     }
     int i;
     i = core.index_in_original(tmp_art);
     art_index = i;
     moves = new int[60];
     move_order = 0;
     bool sz;
     sz = core.is_latin(core.makeArtistWord(tmp_art));
     string kbd;
     if (sz == true) { kbd = core.keyboard_en; } else { kbd = core.keyboard_ru; }
     Random rx = new Random();
     wrd = core.makeArtistWord(tmp_art);
     for (int j = wrd.Length + 1; j <= 15; j++)
     {
         wrd += kbd.Substring(rx.Next(0, kbd.Length), 1);
     }
     string[] symbs = new string[wrd.Length];
     for (int j = 0; j < wrd.Length; j++)
     {
         symbs[j] = wrd.Substring(j, 1);
     }
     Random rnd = new Random();
     string[] MyRand = symbs.OrderBy(x => rnd.Next()).ToArray();
     for (int j = 0; j < 15; j++)
     {
         set_char_for_button(j + 1, MyRand[j]);
     }
     if (tmp_art.word3.Length > 0)
     {
         words_count = 3;
     }
     else
     {
         if (tmp_art.word2.Length > 0)
         {
             words_count = 2;
         }
         else
         {
             words_count = 1;
         }
     }
     split = tmp_art.answerFormat.Split(new Char[] { ' ', '.', ',' });
     word1.Text = "";
     word2.Text = "";
     word3.Text = "";
     if (split.Length > 0)
     {
         word1.Text = split[0];
     }
     if (!(tmp_art.word2.Length > 0))
     {
         word2.Visibility = Visibility.Collapsed;
     }
     else
     {
         if (split.Length > 1)
         {
             word2.Text = split[1];
         }
     }
     if (!(tmp_art.word3.Length > 0))
     {
         word3.Visibility = Visibility.Collapsed;
     }
     else
     {
         if (split.Length > 2)
         {
             word3.Text = split[2];
         }
     }
 }
コード例 #2
0
ファイル: Core.cs プロジェクト: jav1dan/Melomash
 public string makeArtistWord(Artist art)
 {
     return art.word1 + art.word2 + art.word3;
 }
コード例 #3
0
ファイル: Core.cs プロジェクト: jav1dan/Melomash
 public void set_guessed(Artist art)
 {
     string checker;
     checker = String.Format("{0}.{1}", level_ident, makeArtistWord(art));
     IsolatedStorageSettings isos = IsolatedStorageSettings.ApplicationSettings;
     isos.Add(checker, "true");
     isos.Save();
     level_guessed++;
 }
コード例 #4
0
ファイル: Core.cs プロジェクト: jav1dan/Melomash
 public int index_in_original(Artist art)
 {
     int i = 0;
     foreach (Artist artx in main_level.artists)
     {
         if (artx == art)
         {
             return i;
         }
         i++;
     }
     return -1;
 }