コード例 #1
0
ファイル: Genre.cs プロジェクト: damien5215/MVCFormPractice
        public Genre(GenreType genreType, string name = null)
        {
            Id = (int)genreType;

            // If we don't have a name argument,
            // then use the string representation of the genre type for the name.
            Name = name ?? genreType.ToString();
        }
コード例 #2
0
 public Song(string songName, string coverFilename, string songFilename, GenreType genre, string singer, int year, CategoryType categorie, SingType singType, List <Notes> notes)
 {
     this.songName      = songName;
     this.coverFilename = coverFilename;
     this.songFilename  = songFilename;
     this.genre         = genre.ToString();
     this.singer        = singer;
     this.year          = year;
     this.categorie     = categorie.ToString();
     this.singType      = singType;
     this.notes         = notes;
 }
コード例 #3
0
        public string DisplayMovie()
        {
            string movieInfo = title.PadRight(50, ' ') + "| "
                               + starring.PadRight(20, ' ') + "| "
                               + director.PadRight(20, ' ') + "| "
                               + duration.ToString().PadRight(10, ' ') + "| "
                               + genre.ToString().PadRight(10, ' ') + "| "
                               + classification.ToString().PadRight(18, ' ') + "| "
                               + releaseDate.Date.ToString("d").PadRight(12, ' ') + "| "
                               + timesRented.ToString().PadRight(10, ' ') + "| "
                               + copiesAvailable.ToString().PadRight(12, ' ') + "| ";

            return(movieInfo);
        }
コード例 #4
0
ファイル: SongVM.cs プロジェクト: WillVandergrift/Carputer
        /// <summary>
        /// Get a list of songs by the genre
        /// </summary>
        /// <param name="genre"></param>
        /// <returns></returns>
        public List<CarPC.Song> GetSongsByGenre(GenreType genre)
        {
            var songs = from s in db.Songs
                        where s.Genre.ToUpper() == genre.ToString()
                        select s;

            if (songs.Count() > 0)
            {
                return songs.ToList<CarPC.Song>();
            }
            else
            {
                return new List<Song>();
            }
        }
コード例 #5
0
ファイル: ListAll.cs プロジェクト: kmsmith30/movieLibraryApp
        public void InitMovieList(GenreType genre)
        {
            ResetMovies();

            if (genre == GenreType.Null)
            {
                HighlightStar();

                Movies = Movie.LoadAll();
            }
            else
            {
                HideAllAlphaLabels();

                Movies = Movie.LoadByGenre(genre);
            }

            Movies = Movies.OrderBy(o => o.Title).ToList();

            if (genre == GenreType.Null)
            {
                this.Text = $"All Movies ({Movie.NumMovies})";
            }
            else if (genre == GenreType.FilmNoir)
            {
                this.Text = $"Film-Noir Movies ({Movies.Count})";
            }
            else if (genre == GenreType.SciFi)
            {
                this.Text = $"Sci-Fi Movies ({Movies.Count})";
            }
            else
            {
                this.Text = genre.ToString() + $" Movies ({Movies.Count})";
            }

            SetPageValues();
        }
コード例 #6
0
    void SetupSong()
    {
        GUILayout.BeginArea(new Rect(10, 35, 850, 850));

        EditorGUIUtility.labelWidth = 120;

        GUILayout.BeginHorizontal(GUILayout.Height(100));

        GUILayout.BeginVertical();

        GUIContent sName = new GUIContent();

        texture = EditorGUILayout.ObjectField(sName, texture, typeof(Sprite), true,
                                              GUILayout.Width(EditorGUIUtility.singleLineHeight * 8),
                                              GUILayout.Height(EditorGUIUtility.singleLineHeight * 8)) as Sprite;

        if (texture != null)
        {
            song.coverFilename = texture.name;
        }

        if (GUILayout.Button("Carregar", GUILayout.Width(EditorGUIUtility.singleLineHeight * 8)))
        {
            var fileImage = EditorUtility.OpenFilePanel("Carregar Image", "", "png,jpg,jpge");

            var      resources    = Application.dataPath + "/Resources/Cover";
            var      filename     = Path.GetFileName(fileImage);
            string[] paths        = { resources, filename };
            var      fullFilename = Path.Combine(paths);

            File.Copy(fileImage, fullFilename);

            AssetDatabase.Refresh();
            texture = Resources.Load <Sprite>("Cover/" + Path.GetFileNameWithoutExtension(filename));
        }


        GUILayout.EndVertical();

        EditorGUILayout.Space(20);

        GUILayout.BeginVertical();

        sName.text    = "Nome da Musica: ";
        song.songName = EditorGUILayout.TextField(sName, song.songName, GUILayout.Width(400));


        GUILayout.BeginHorizontal();

        sName.text        = "Arquivo da Musica: ";
        song.songFilename = EditorGUILayout.TextField(sName, song.songFilename, GUILayout.Width(316));

        if (GUILayout.Button("Carregar", GUILayout.Width(80)))
        {
            fileSongPath      = EditorUtility.OpenFilePanel("Carregar Musica", "", "mp3");
            song.songFilename = Path.GetFileNameWithoutExtension(fileSongPath);
        }

        GUILayout.EndHorizontal();

        sName.text  = "Nome do Cantor: ";
        song.singer = EditorGUILayout.TextField(sName, song.singer, GUILayout.Width(400));

        sName.text = "Genero Musical: ";
        genre      = (GenreType)EditorGUILayout.EnumPopup(sName, genre, GUILayout.Width(300));
        song.genre = genre.ToString();

        sName.text = "Ano da Musica: ";
        song.year  = EditorGUILayout.IntField(sName, song.year, GUILayout.Width(175));

        sName.text     = "Categoria: ";
        category       = (CategoryType)EditorGUILayout.EnumPopup(sName, category, GUILayout.Width(400));
        song.categorie = category.ToString();

        sName.text    = "Tipo de Cantor: ";
        song.singType = (SingType)EditorGUILayout.EnumPopup(sName, song.singType, GUILayout.Width(300));

        GUILayout.EndVertical();

        GUILayout.BeginHorizontal();

        GUILayout.BeginVertical();

        if (GUILayout.Button(textureExcluir, GUILayout.Width(60), GUILayout.Height(60)))
        {
            var popup = GetWindow <SongEditorConfirm>("Format");
            popup.position = new Rect(350, 350, 350, 75);
            popup.ShowPopup();
            popup.Focus();
        }

        if (GUILayout.Button(textureSalvar, GUILayout.Width(60), GUILayout.Height(60)))
        {
            SaveSong();
        }

        GUILayout.EndVertical();

        GUILayout.BeginVertical();

        if (GUILayout.Button(textureSalvar, GUILayout.Width(60), GUILayout.Height(60)))
        {
            StartPlay();
        }

        GUILayout.EndVertical();

        GUILayout.EndHorizontal();

        GUILayout.EndHorizontal();

        EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);

        GUILayout.Space(5);

        //Notas
        var style = new GUIStyle(GUI.skin.textArea)
        {
            alignment = TextAnchor.MiddleCenter
        };

        //fullSubtitle = EditorGUILayout.TextArea(fullSubtitle, style,GUILayout.ExpandWidth(true), GUILayout.Height(70));
        GUILayout.Space(5);

        pos = EditorGUILayout.BeginScrollView(pos, false, true, GUILayout.Height(300));

        GUILayout.BeginVertical();

        sName.text = "Nova Legenda";
        if (GUILayout.Button(sName, GUILayout.Width(Screen.width - 40)))
        {
            song.notes.Add(new Notes());
        }

        GUILayout.Space(10);

        GUILayout.BeginHorizontal();

        if (Event.current.type == EventType.KeyUp &&
            (Event.current.modifiers == EventModifiers.Control || Event.current.modifiers == EventModifiers.Command) &&
            GUI.GetNameOfFocusedControl() == "Subtitle")
        {
            if (Event.current.keyCode == KeyCode.V)
            {
                var sub = song.notes[0].subtitle;
                song.notes.Clear();

                SaveAndLoad.Save("Teste", sub, ".txt");

                using (StringReader reader = new StringReader(sub))
                {
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        if (line != "")
                        {
                            song.notes.Add(new Notes(line));
                        }
                    }
                }
            }
        }

        GUILayout.Label("Tempo de Inicio");

        GUILayout.FlexibleSpace();

        GUILayout.Label("Letra");

        GUILayout.FlexibleSpace();

        GUILayout.Label("Tempo de Encerramento");

        if (song.singType == SingType.DUET)
        {
            GUILayout.FlexibleSpace();

            GUILayout.Label("Cantor do dueto");
        }

        GUILayout.Space(15);

        GUILayout.EndHorizontal();

        foreach (var note in song.notes.ToList())
        {
            GUILayout.BeginHorizontal();

            sName.text = "x";
            if (GUILayout.Button(sName))
            {
                song.notes.Remove(note);
            }

            note.startTime = EditorGUILayout.TextField(formatTime(note.startTime), GUILayout.Width(75));

            GUILayout.FlexibleSpace();

            GUI.SetNextControlName("Subtitle");
            note.subtitle = EditorGUILayout.TextArea(note.subtitle, GUILayout.Width(song.singType != SingType.DUET?600:500));

            GUILayout.FlexibleSpace();

            note.endTime = EditorGUILayout.TextField(formatTime(note.endTime), GUILayout.Width(75));

            if (song.singType == SingType.DUET)
            {
                GUILayout.FlexibleSpace();

                note.duetSinger = (DuetSinger)EditorGUILayout.EnumPopup(note.duetSinger, GUILayout.Width(100));
            }
            GUILayout.Space(15);


            GUILayout.EndHorizontal();
        }

        GUILayout.Space(20);

        GUILayout.EndVertical();

        GUILayout.EndArea();


        GUILayout.EndScrollView();


        Event e = Event.current;

        if (e.commandName == "Confirmar")
        {
            Clean();
        }
    }
コード例 #7
0
 public void SetGenre(GenreType genreType)
 {
     Console.WriteLine($"Genre set to {genreType.ToString()}");
     genre = genreType;
 }