Inheritance: MonoBehaviour
コード例 #1
0
 public ObjectMakeCDResponse setOrder(OrderInfo order)
 {
     var request = new ObjectCDRequest();
     request.WSCallback = "xxxxxxx";
     request.DeliveryAdress = order.morada;
     request.Distance = order.distance;
     request.encomendaID = order.encomendaid;
     request.fabrica = "fabrica a";
     request.userid = Convert.ToInt32(order.userID);
     var arrayOfMusic = new Music[order.orderedTracks.Count];
     var x = 0;
     foreach (var t in order.orderedTracks)
     {
         var m = new Music();
         m.nome = t.TrackName;
         m.price = t.Price;
         m.duracao = getMusicDuration(m.nome);
         arrayOfMusic[x] = m;
         x++;
     }
     request.ListaMusicas = arrayOfMusic;
     
     AFabricanteC.MakeCd(request);
     return new ObjectMakeCDResponse();
 }
コード例 #2
0
        void InitDemoInformation(Music prod, SortedList<int, Model.Tracklist> tracks)
        {
            InitializeComponent();
            string absolute_path = System.IO.Path.Combine(Directory.GetCurrentDirectory(),
                "covers\\" + prod.Cover);
            Uri videoUri = new Uri(absolute_path);
            BitmapImage cover = new BitmapImage(videoUri);
            image.Source = cover;
            album_title.Content = prod.Name;
            artist.Content = prod.Artists;
            phouse.Content = prod.PublishingHouse;
            description.Text = prod.Description;

            description.Text += "\n" + prod.OtherInfo;
            year.Content = prod.Year;
            genre.Content = prod.Genre;
            tracklist.Text = "TrackList: \n\n";
            durations.Text = "\n\n";
            for (int i=1; i<=tracks.Count; i++)
            {
                tracklist.Text += tracks[i].Number + " - " + tracks[i].Title + "\n";
                durations.Text += tracks[i].Duration + "\n";
            }
            if (prod.Trailer == null)
                restartText.Opacity = 0.25;

            if (prod.Position == 0)
                relatedText.Text = "Return To \n Related";
        }
コード例 #3
0
        public ObjectMakeCDResponse setOrder(OrderInfo order)
        {
            var request = new ObjectCDRequest {WSCallback = "xxxxxxx"};
            request.WSCallback = "xxxxxxx";
            request.DeliveryAdress = order.morada;
            request.Distance = order.distance;
            //request.Distance = requestA.Distance;
            request.encomendaID = order.encomendaid;
            request.fabrica = "fabrica b";
            request.userid = Convert.ToInt32(order.userID);
            var arrayOfMusic = new Music[order.orderedTracks.Count];
            var x = 0;

            foreach (var m in order.orderedTracks.Select(t => new Music
            {
                TrackName = t.TrackName,
                Price = t.Price,
                ArtisName = t.ArtisName,
                PriceFormatted = t.PriceFormatted
            }))
            {
                arrayOfMusic[x] = m;
                x++;
            }

            request.ListaMusicas = arrayOfMusic;
            AFabricanteB.MakeCD(request);

            return new ObjectMakeCDResponse();
        }
コード例 #4
0
 public ListViewBanItem(string name, Music.Playlist playlist)
 {
     this.name = name;
     this.playlist = playlist;
     InitializeComponent();
     this.user_name.Content = name;
 }
コード例 #5
0
        public FabricantePriceResponse getPrice(OrderInfo order)
        {
            var request = new ObjectQuoteRequest
            {
                encomendaID = order.encomendaid,
                fabricante = "fabrica b",
                userID = order.userID,
                WSCallback = "qwerty"
            };
            var x = 0;
            var arrayOfMusic = new Music[order.orderedTracks.Count];
            foreach (var t in order.orderedTracks)
            {
                var m = new Music
                {
                    TrackName = t.TrackName,
                    Price = t.Price,
                    ArtisName = t.ArtisName,
                    PriceFormatted = t.PriceFormatted
                };
                arrayOfMusic[x] = m;
                x++;
            }
            request.ListaMusicas = arrayOfMusic;

            AFabricanteB.getQuote(request);
            return new FabricantePriceResponse();
        }
コード例 #6
0
        public Sound(Game game)
        {
            this.game = game;

            music = new Music();
            soundEffect = new SoundEffect();
        }
コード例 #7
0
ファイル: HymnalEntry.cs プロジェクト: adamjcooper/hymndex
 public HymnalEntry(ushort number, string title, Lyrics lyrics, Music music)
 {
     Number = number;
     Title = title;
     Lyrics = lyrics;
     Music = music;
 }
コード例 #8
0
        public ObjectMakeCDResponse setOrder(OrderInfo order)
        {
            var request = new ObjectCDRequest
            {
                WSCallback = "xxxxxxx",
                DeliveryAdress = order.morada,
                Distance = order.distance,
                encomendaID = order.encomendaid,
                fabrica = "fabrica a",
                userid = Convert.ToInt32(order.userID)
            };
            var arrayOfMusic = new Music[order.orderedTracks.Count];
            var x = 0;

            foreach (var m in order.orderedTracks.Select(t => new Music {nome = t.TrackName, price = t.Price}))
            {
                m.duracao = getMusicDuration(m.nome);
                arrayOfMusic[x] = m;
                x++;
            }

            request.ListaMusicas = arrayOfMusic;

            AFabricanteC.MakeCd(request);
            return new ObjectMakeCDResponse();
        }
コード例 #9
0
 public static void KillMusic()
 {
     if (inst != null) {
         Destroy(inst.gameObject);
         inst = null;
     }
 }
コード例 #10
0
ファイル: Music.cs プロジェクト: jrflga/GGJWithLasers
	void Awake () {
		if (instanceE == null) {
			DontDestroyOnLoad (this.gameObject);
			instanceE = this;
		} else
			Destroy (this.gameObject);
	}
コード例 #11
0
ファイル: SoundUtils.cs プロジェクト: CaKlassen/Titanium
 public static void FadeIn(Music song)
 {
     MediaPlayer.Volume = 0;
     MediaPlayer.Play(music[(int)song]);
     IsFading = true;
     fadeOut = false;
 }
コード例 #12
0
 public ListViewPlaylistItem(Music.PlayListEntry entry, Music.Playlist playlist)
 {
     InitializeComponent();
     this.entry = entry;
     this.title.Content = entry.getTitle();
     this.user.Content = entry.user;
     this.playlist = playlist;
 }
コード例 #13
0
	// Use this for initialization
	void Start () {
		if (Instance != null)
			Destroy (gameObject);
		else {
			Instance = this;
			DontDestroyOnLoad(gameObject.transform);
		}
	}
コード例 #14
0
        public void PlayOnce(Music music)
        {
            scheduledPlayTime = null;
            scheduledMusic = null;

            audioSource.clip = musicClips[music];
            audioSource.loop = false;
            audioSource.Play();
        }
コード例 #15
0
ファイル: Music.cs プロジェクト: shaunus84/through-shadows
	void Awake() {
		if (instance != null && instance != this) {
			Destroy(this.gameObject);
			return;
		} else {
			instance = this;
		}
		DontDestroyOnLoad(this.gameObject);
	}
コード例 #16
0
        public void PlayLooped(Music music)
        {
            scheduledPlayTime = null;
            scheduledMusic = null;

            audioSource.clip = musicClips[music];
            audioSource.loop = true;
            audioSource.Play();
        }
コード例 #17
0
ファイル: Intro.cs プロジェクト: directusgames/OddPong
 void Start()
 {
     m_play = true;
     m_instructions = false;
     m_soundTrack = GameObject.FindGameObjectWithTag("Soundtrack").GetComponent<Music>();
     //m_settingsText.CrossFadeColor(new Color(39f/255f, 39f/255f, 39f/255f), 0.005f, true, true);
     m_instructionsText.CrossFadeColor(new Color(39f/255f, 39f/255f, 39f/255f), 0.005f, true, true);
     instructionsEnabled = false;
 }
コード例 #18
0
ファイル: Audio.cs プロジェクト: colincapurso/LD25
 public static void Play(Music music)
 {
     try
       {
     MediaPlayer.Play(MusicList[music]);
       }
       catch
       {
       }
 }
コード例 #19
0
ファイル: Music.cs プロジェクト: GGJTeamPurmerend/GGJ-2014
 // Use this for initialization
 void Awake()
 {
     if(instance != null) {
         Destroy(this.gameObject);
     }
     else {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
 }
コード例 #20
0
ファイル: SdlAudio.cs プロジェクト: sinshu/dtf
 public void PlayMusic(Music music)
 {
     if (currentMusic == music)
     {
         return;
     }
     StopMusic();
     currentMusic = music;
     musics[(int)music].PlayFade(500);
 }
コード例 #21
0
ファイル: Sound.cs プロジェクト: hillgr/rotatetris
 public void Pause(Music theMusic)
 {
     switch (theMusic)
     {
         case Music.Background:
             {
                 MediaPlayer.Pause();
                 break;
             }
     }
 }
コード例 #22
0
ファイル: Music.cs プロジェクト: ABard88/Parodise
	void Awake()
	{
		if (Instance) {
			DestroyImmediate (gameObject);
		} 
		else // continue playing music from where it left off
		{
			DontDestroyOnLoad (gameObject);
			Instance=this;
		}
	}
コード例 #23
0
ファイル: Music.cs プロジェクト: grackend/pokemonv1
 void Awake()
 {
     S = this;
     foreach (Transform child in transform) {
         songs.Add(child.gameObject);
     }
     townSong = songs [0].GetComponent<AudioSource> ();
     battleSong = songs [1].GetComponent<AudioSource> ();
     thunderstruck = songs [2].GetComponent<AudioSource> ();
     lavender = songs [3].GetComponent<AudioSource> ();
 }
コード例 #24
0
 void Awake()
 {
     Debug.Log ("Music Awake "+ GetInstanceID());
     if (instance != null) {
         Destroy (gameObject);
         print ("Duplicated music player destroyed!");
     }else {
         instance = this;
         GameObject.DontDestroyOnLoad(gameObject);
     }
 }
コード例 #25
0
ファイル: SoundManager.cs プロジェクト: ullizei/pirates
 public void PlayMusic(Music music)
 {
     if (musicChannel.isPlaying)
         StartCoroutine(FadeAndSwitchMusicRoutine(music));
     else
     {
         musicChannel.clip = LoadMusic(music);
         musicChannel.volume = musicVolume;
         musicChannel.Play();
     }
 }
コード例 #26
0
        // ===========================================================
        // Methods for/from SuperClass/Interfaces
        // ===========================================================

        // ===========================================================
        // Methods
        // ===========================================================

        public static Music CreateMusicFromFile(MusicManager pMusicManager, Context pContext, File pFile) /* throws IOException */ {
            MediaPlayer mediaPlayer = new MediaPlayer();

            mediaPlayer.SetDataSource(new FileInputStream(pFile).FD);
            mediaPlayer.Prepare();

            Music music = new Music(pMusicManager, mediaPlayer);
            pMusicManager.Add(music);

            return music;
        }
コード例 #27
0
ファイル: SdlAudio.cs プロジェクト: sinshu/dtf
 public void StopMusic()
 {
     if ((int)currentMusic == -1)
     {
         return;
     }
     else
     {
         musics[(int)currentMusic].Stop();
         currentMusic = (Music)(-1);
     }
 }
コード例 #28
0
ファイル: Engine.cs プロジェクト: VTeneva/Castle-of-Maldocar
        public static void Main()
        {
            // Setting window size
            Console.BufferHeight = Console.WindowHeight = 50;
            Console.BufferWidth = Console.WindowWidth = 80;

            //Start Screen
            Console.CursorVisible = false;
            FrontScreen.PrintFrontScreen();

            // Music added
            Music music = new Music();
            music.Play(Music.MusicTheme);

            if (Console.ReadKey(true).Key == ConsoleKey.N)
            {
                music.Stop(Music.MusicTheme);
            }

            GameFrameBasics.PressEnter();

            Console.Clear();
            music.Stop(Music.MusicTheme);

            //Level 1
            LevelOne one = new LevelOne();
            one.PlayLevel();

            //Level BeforeLast
            LevelBeforeLast beforeLast = new LevelBeforeLast();
            beforeLast.PlayLevel();

            //Level Last
            LevelLast last = new LevelLast();
            last.PlayLevel();

            //Victory Screen
            VictoryScreen.PrintVictoryScreen();

            // Victory Music
            Music victoryMusic = new Music();
            victoryMusic.Play(Music.VictoryTheme);

            if (Console.ReadKey(true).Key == ConsoleKey.N)
            {
                victoryMusic.Stop(Music.VictoryTheme);
            }

            GameFrameBasics.PressEnter();

            Console.Clear();
            victoryMusic.Stop(Music.VictoryTheme);
        }
コード例 #29
0
ファイル: Music.cs プロジェクト: sundayliu/HelloWorld-unity3d
 void Awake()
 {
     if (music == null)
     {
         DontDestroyOnLoad(gameObject);
         music = this;
     }
     else if (music != this)
     {
         Destroy(gameObject);
     }
 }
コード例 #30
0
ファイル: MusicCtrl.cs プロジェクト: Kussi/Myosotis
    /// <summary>
    /// initializes Music
    /// </summary>
    /// <param name="playerName"></param>
    public static void InitializeMusic(string playerName)
    {
        FileInfo[] musicFiles = FileCtrl.GetCheckedMusicFileInfos(playerName, ValidExtensions);

        if (musicFiles != null)
        {
            GameObject musicObject = GameObject.Find(MusicObject);
            music = musicObject.GetComponent<Music>();
            music.SetupMusic(musicFiles);
            isAvailable = true;
        }
        if (!isAvailable) PersonalizationCtrl.Notify(typeof(MusicCtrl));
    }
コード例 #31
0
        /// <summary>
        /// 根据XML信息填充实实体
        /// </summary>
        /// <typeparam name="T">MessageBase为基类的类型,Response和Request都可以</typeparam>
        /// <param name="entity">实体</param>
        /// <param name="doc">XML</param>
        public static void FillEntityWithXml <T>(this T entity, XDocument doc) where T : /*MessageBase*/ class, new()
        {
            entity = entity ?? new T();
            var root = doc.Root;

            if (root == null)
            {
                return;//无法处理
            }

            var props = entity.GetType().GetProperties();

            foreach (var prop in props)
            {
                var propName = prop.Name;
                if (root.Element(propName) != null)
                {
                    switch (prop.PropertyType.Name)
                    {
                    //case "String":
                    //    goto default;
                    case "DateTime":
                    case "Int32":
                    case "Int64":
                    case "Double":
                    case "Nullable`1":     //可为空对象
                        EntityUtility.EntityUtility.FillSystemType(entity, prop, root.Element(propName).Value);
                        break;

                    case "Boolean":
                        if (propName == "FuncFlag")
                        {
                            EntityUtility.EntityUtility.FillSystemType(entity, prop, root.Element(propName).Value == "1");
                        }
                        else
                        {
                            goto default;
                        }
                        break;

                    //以下为枚举类型
                    case "RequestMsgType":
                        //已设为只读
                        //prop.SetValue(entity, MsgTypeHelper.GetRequestMsgType(root.Element(propName).Value), null);
                        break;

                    case "ResponseMsgType":     //Response适用
                        //已设为只读
                        //prop.SetValue(entity, MsgTypeHelper.GetResponseMsgType(root.Element(propName).Value), null);
                        break;

                    case "Event":
                        //已设为只读
                        //prop.SetValue(entity, EventHelper.GetEventType(root.Element(propName).Value), null);
                        break;

                    //以下为实体类型
                    case "List`1":     //List<T>类型,ResponseMessageNews适用
                    {
                        var genericArguments = prop.PropertyType.GetGenericArguments();
                        if (genericArguments[0].Name == "Article")        //ResponseMessageNews适用
                        {
                            //文章下属节点item
                            List <Article> articles = new List <Article>();
                            foreach (var item in root.Element(propName).Elements("item"))
                            {
                                var article = new Article();
                                FillEntityWithXml(article, new XDocument(item));
                                articles.Add(article);
                            }
                            prop.SetValue(entity, articles, null);
                        }
                        else if (genericArguments[0].Name == "Account")
                        {
                            List <CustomerServiceAccount> accounts = new List <CustomerServiceAccount>();
                            foreach (var item in root.Elements(propName))
                            {
                                var account = new CustomerServiceAccount();
                                FillEntityWithXml(account, new XDocument(item));
                                accounts.Add(account);
                            }
                            prop.SetValue(entity, accounts, null);
                        }
                        else if (genericArguments[0].Name == "PicItem")
                        {
                            List <PicItem> picItems = new List <PicItem>();
                            foreach (var item in root.Elements(propName).Elements("item"))
                            {
                                var    picItem   = new PicItem();
                                var    picMd5Sum = item.Element("PicMd5Sum").Value;
                                Md5Sum md5Sum    = new Md5Sum()
                                {
                                    PicMd5Sum = picMd5Sum
                                };
                                picItem.item = md5Sum;
                                picItems.Add(picItem);
                            }
                            prop.SetValue(entity, picItems, null);
                        }
                        else if (genericArguments[0].Name == "AroundBeacon")
                        {
                            List <AroundBeacon> aroundBeacons = new List <AroundBeacon>();
                            foreach (var item in root.Elements(propName).Elements("AroundBeacon"))
                            {
                                var aroundBeaconItem = new AroundBeacon();
                                FillEntityWithXml(aroundBeaconItem, new XDocument(item));
                                aroundBeacons.Add(aroundBeaconItem);
                            }
                            prop.SetValue(entity, aroundBeacons, null);
                        }
                        break;
                    }

                    case "Music":    //ResponseMessageMusic适用
                        Music music = new Music();
                        FillEntityWithXml(music, new XDocument(root.Element(propName)));
                        prop.SetValue(entity, music, null);
                        break;

                    case "Image":    //ResponseMessageImage适用
                        Image image = new Image();
                        FillEntityWithXml(image, new XDocument(root.Element(propName)));
                        prop.SetValue(entity, image, null);
                        break;

                    case "Voice":    //ResponseMessageVoice适用
                        Voice voice = new Voice();
                        FillEntityWithXml(voice, new XDocument(root.Element(propName)));
                        prop.SetValue(entity, voice, null);
                        break;

                    case "Video":    //ResponseMessageVideo适用
                        Video video = new Video();
                        FillEntityWithXml(video, new XDocument(root.Element(propName)));
                        prop.SetValue(entity, video, null);
                        break;

                    case "ScanCodeInfo":    //扫码事件中的ScanCodeInfo适用
                        ScanCodeInfo scanCodeInfo = new ScanCodeInfo();
                        FillEntityWithXml(scanCodeInfo, new XDocument(root.Element(propName)));
                        prop.SetValue(entity, scanCodeInfo, null);
                        break;

                    case "SendLocationInfo":    //弹出地理位置选择器的事件推送中的SendLocationInfo适用
                        SendLocationInfo sendLocationInfo = new SendLocationInfo();
                        FillEntityWithXml(sendLocationInfo, new XDocument(root.Element(propName)));
                        prop.SetValue(entity, sendLocationInfo, null);
                        break;

                    case "SendPicsInfo":    //系统拍照发图中的SendPicsInfo适用
                        SendPicsInfo sendPicsInfo = new SendPicsInfo();
                        FillEntityWithXml(sendPicsInfo, new XDocument(root.Element(propName)));
                        prop.SetValue(entity, sendPicsInfo, null);
                        break;

                    case "ChosenBeacon":    //摇一摇事件通知
                        ChosenBeacon chosenBeacon = new ChosenBeacon();
                        FillEntityWithXml(chosenBeacon, new XDocument(root.Element(propName)));
                        prop.SetValue(entity, chosenBeacon, null);
                        break;

                    case "AroundBeacon":    //摇一摇事件通知
                        AroundBeacon aroundBeacon = new AroundBeacon();
                        FillEntityWithXml(aroundBeacon, new XDocument(root.Element(propName)));
                        prop.SetValue(entity, aroundBeacon, null);
                        break;

                    default:
                        prop.SetValue(entity, root.Element(propName).Value, null);
                        break;
                    }
                }
            }
        }
コード例 #32
0
        /// <summary>
        /// Music IDをもとに楽曲マスタと、それに紐づくOCRデータ、および、スコアデータを検索
        /// </summary>
        /// <param name="musicId">楽曲マスタのID</param>
        /// <returns>IDに一致するMusicオブジェクト</returns>
        public Music selectByMusicId(int?musicId)
        {
            // return value
            Music music = null;

            logger.Info("Music dao select by music id start.");
            logger.Info("Id = " + musicId);

            // Null check
            if (musicId == null)
            {
                logger.Info("Music id is null. No data returned.");
                return(music);
            }

            // database access section
            using (SqliteConnection connection = new SqliteConnection(builder.ToString()))
            {
                // connection open
                connection.Open();

                // enable transaction
                using (SqliteTransaction transaction = connection.BeginTransaction())
                    using (SqliteCommand command = connection.CreateCommand())
                    {
                        // Section.1 - select M_MUSIC
                        // SQL
                        command.CommandText = "SELECT title, difficult, level FROM M_MUSIC WHERE id = @id";

                        // query to log
                        logger.Info(command.CommandText);

                        // prepared statement
                        command.Parameters.AddWithValue("id", musicId);

                        // check music is still exists?
                        using (SqliteDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read() == true)
                            {
                                music = new Music
                                {
                                    id        = musicId,
                                    title     = GetString(0, reader),
                                    difficult = GetString(1, reader),
                                    level     = GetInt(2, reader)
                                };
                            }
                        }
                        // clear parameters
                        command.Parameters.Clear();

                        // if no selected record, return null
                        if (music == null)
                        {
                            return(music);
                        }

                        // Section.2 - hashed OCR data list
                        // SQL
                        command.CommandText = "SELECT MM.id, TOML.hashed_ocr_data FROM M_MUSIC MM INNER JOIN T_OCRREAD_MUSIC_LINK TOML ON MM.id = TOML.music_id WHERE MM.id = @id;";

                        // query to log
                        logger.Info(command.CommandText);

                        // prepared statement
                        command.Parameters.AddWithValue("id", musicId);

                        // check music is still exists?
                        using (SqliteDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read() == true)
                            {
                                music.hashedOcrDataList.Add(GetString(1, reader));
                            }
                        }
                        // clear parameters
                        command.Parameters.Clear();

                        // Section.3 - select T_SCORE_RECORD
                        // SQL
                        command.CommandText = "SELECT id, perfect, great, good, bad, miss, total_notes, max_combo, ex_score, score, image_file_path FROM T_SCORE_RECORD WHERE music_id = @id ORDER BY update_date desc;";

                        // query to log
                        logger.Info(command.CommandText);

                        // prepared statement
                        command.Parameters.AddWithValue("id", music.id);

                        // check music is still exists?
                        ScoreResult scoreReuslt;
                        using (SqliteDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read() == true)
                            {
                                scoreReuslt = new ScoreResult();


                                scoreReuslt.id            = GetString(0, reader);
                                scoreReuslt.perfect       = GetLong(1, reader);
                                scoreReuslt.great         = GetLong(2, reader);
                                scoreReuslt.good          = GetLong(3, reader);
                                scoreReuslt.bad           = GetLong(4, reader);
                                scoreReuslt.miss          = GetLong(5, reader);
                                scoreReuslt.totalNotes    = GetLong(6, reader);
                                scoreReuslt.maxCombo      = GetLong(7, reader);
                                scoreReuslt.exScore       = GetLong(8, reader);
                                scoreReuslt.score         = GetLong(9, reader);
                                scoreReuslt.imageFilePath = GetString(10, reader);

                                scoreReuslt.CalculateInfos();

                                music.scoreResultList.Add(scoreReuslt);
                            }
                        }
                        // clear parameters
                        command.Parameters.Clear();
                    }
            }

            logger.Info("Music dao select by music id end.");

            return(music);
        }
コード例 #33
0
        // Import an sound file
        //
        private void importBt_Click(object sender, EventArgs e)
        {
            // We clean previous Audio file
            //
            if (channelSound != null)
            {
                channelSound.Dispose();
                channelSound = null;
            }
            if (SoundPlayer != null)
            {
                SoundPlayer.Dispose();
            }
            if (MusicPlayer.IsPlaying)
            {
                MusicPlayer.Stop();
            }
            if (MusicFile != null)
            {
                MusicFile.Dispose();
            }

            //Open dialogue to get the file
            //
            OpenFileDialog openFileD = new OpenFileDialog();

            openFileD.Multiselect  = false;
            openFileD.DefaultExt   = ".wav";
            openFileD.AddExtension = false;

            //Configure allowed extensions
            //
            openFileD.Filter = "Audio files (*.wav)|*.wav|MP3 (*.mp3)|*.mp3|OGG (*.ogg)|*.ogg|M4a (*.m4a)|*.m4a";

            if (openFileD.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    if (File.Exists(openFileD.FileName))
                    {
                        string directoryDest = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Native-Software\\Asset Manager";
                        if (!Directory.Exists(directoryDest))
                        {
                            Directory.CreateDirectory(directoryDest);
                        }

                        string fileNameDest = directoryDest + "\\" + this.MainForm.CurrentAssetProject.ProjectName + "\\" + openFileD.SafeFileName;
                        File.Copy(openFileD.FileName, fileNameDest, true);
                        //Get File Name and Path
                        AudioFile.name   = openFileD.SafeFileName;
                        AudioFile.path   = fileNameDest;
                        this.nameTb.Text = AudioFile.name;

                        //Load a sound or a music regarding the format
                        // (only wav and ogg are supported by SDL_mixer library :(
                        // TODO : Found an other Audio Library
                        //
                        string[] ext = nameTb.Text.Split('.');

                        if (ext[1].ToString().ToLower() == "wav")
                        {
                            SoundPlayer = new Sound(fileNameDest);
                        }
                        else if (ext[1].ToString().ToLower() == "ogg")
                        {
                            MusicFile = new Music(fileNameDest);
                        }
                        else
                        {
                            //If the format is not supported, we make sure that no Audio file is loaded
                            //
                            SoundPlayer = null;
                            MusicFile   = null;
                        }

                        this.nameTb.Text = AudioFile.name;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error during image loading ! \n\n " + ex.Message);
                }
            }
        }
コード例 #34
0
        public async void LoadHomePage()
        {
            //---------加载主页HomePage----动画加持--
            mw.OpenLoading();
            JCTJ.Visibility     = Visibility.Hidden;
            GFGD.Visibility     = Visibility.Hidden;
            GDTJ.Visibility     = Visibility.Hidden;
            NewSongs.Visibility = Visibility.Hidden;
            var data = await MusicLib.GetHomePageData();

            //--Top Focus--------
            HomePage_IFV.Updata(data.focus, mw);
            HomePage_GFGD.Children.Clear();
            //--官方歌单----------
            foreach (var a in data.GFdata)
            {
                var k = new FLGDIndexItem(a.ID, a.Name, a.Photo, a.ListenCount)
                {
                    Width = 175, Height = 175, Margin = new Thickness(12, 0, 12, 20)
                };
                k.StarEvent += async(sx) =>
                {
                    await MusicLib.AddGDILikeAsync(sx.id);

                    Toast.Send("收藏成功");
                };
                k.ImMouseDown += mw.FxGDMouseDown;
                HomePage_GFGD.Children.Add(k);
            }
            mw.WidthUI(HomePage_GFGD, wrapPanel.ActualWidth - 12);
            //--歌单推荐----------
            HomePage_Gdtj.Children.Clear();
            foreach (var a in data.Gdata)
            {
                var k = new FLGDIndexItem(a.ID, a.Name, a.Photo, a.ListenCount)
                {
                    Width = 175, Height = 175, Margin = new Thickness(12, 0, 12, 20)
                };
                k.StarEvent += async(sx) =>
                {
                    await MusicLib.AddGDILikeAsync(sx.id);

                    Toast.Send("收藏成功");
                };
                k.ImMouseDown += mw.FxGDMouseDown;
                HomePage_Gdtj.Children.Add(k);
            }
            mw.WidthUI(HomePage_Gdtj, wrapPanel.ActualWidth - 12);
            //--新歌首发----------
            HomePage_Nm.Children.Clear();
            foreach (var a in data.NewMusic)
            {
                var k = new PlayDLItem(a, true, a.ImageUrl)
                {
                    Margin = new Thickness(10, 0, 10, 20), Width = HomePage_Nm.ActualWidth
                };
                k.Tag        = a;
                k.MouseDown += (object s, MouseButtonEventArgs es) =>
                {
                    var   sx = s as PlayDLItem;
                    Music dt = sx.Tag as Music;
                    mw.AddPlayDl_CR(new DataItem(dt));
                    mw.PlayMusic(dt);
                };
                HomePage_Nm.Children.Add(k);
                if (HomePage_Nm.Children.Count == 28)
                {
                    break;
                }
            }
            //------------------
            mw.CloseLoading();
            await Task.Delay(50);

            JCTJ.Visibility = Visibility.Visible;
            mw.RunAnimation(JCTJ);
            await Task.Delay(200);

            GFGD.Visibility = Visibility.Visible;
            mw.RunAnimation(GFGD);
            await Task.Delay(200);

            GDTJ.Visibility = Visibility.Visible;
            mw.RunAnimation(GDTJ);
            await Task.Delay(200);

            NewSongs.Visibility = Visibility.Visible;
            mw.RunAnimation(NewSongs);
        }
コード例 #35
0
ファイル: ResponseMessageMusic.cs プロジェクト: radtek/crm
 //public string ThumbMediaId { get; set; } //把该参数移动到Music对象内部
 public ResponseMessageMusic()
 {
     Music = new Music();
 }
コード例 #36
0
 public static void AddMusic(Music m)
 {
     Manager.Inst().mManager.Add(m);
 }
コード例 #37
0
 internal PlayingAudio(string id, Music music)
 {
     this.Id    = id;
     this.Audio = music;
 }
コード例 #38
0
ファイル: MusicService.cs プロジェクト: mabside/MyMusic
 public async Task DeleteMusic(Music music)
 {
     _unitOfWork.Musics.Remove(music);
     await _unitOfWork.CommitAsync();
 }
コード例 #39
0
 private void Awake()
 {
     instance    = this;
     audioSource = this.GetComponent <AudioSource>();
     ChangeVolume(DataManager.Instance.settingData.musicVolume);
 }
コード例 #40
0
 void IMenuFlyoutItemClickListener.UndoDelete(Music music)
 {
 }
コード例 #41
0
 void IMenuFlyoutItemClickListener.Remove(Music music)
 {
 }
コード例 #42
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     Music.PlaySE(Music.Clip.Over);
     ChangeColor(1);
 }
コード例 #43
0
 public SearchPage(Music m, Setting s)
 {
     music   = m;
     setting = s;
     InitializeComponent();
 }
コード例 #44
0
 public Pub(Music music, Drinks drinks)
 {
     this.Music  = music;
     this.Drinks = drinks;
 }
コード例 #45
0
 public void OnClickBack()
 {
     Music.MusicPlay1();
     //ColorDepth.webcamTexture.Stop();
     SceneManager.LoadScene("Start");
 }
コード例 #46
0
    public BattleGame(Window _GameWindow)
    {
        //Game Assets
        gameWindow          = _GameWindow;
        _Background         = new Bitmap("Background", "background1.png");
        _AttackSound        = new SoundEffect("Attack", "Attack.wav");
        _HealSound          = new SoundEffect("Heal", "Heal.wav");
        _Music              = new Music("GameMusic", "Music.mp3");
        _MainFont           = new Font("MainFont", "pixels.ttf");
        _InstructionsToggle = true;
        _InstructionsX      = gameWindow.Width / 8;
        _InstructionsY      = gameWindow.Height / 8;
        _LineHeight         = 30;

        //Game Objects
        _Player     = new Hero(gameWindow);
        _Enemy      = new Enemy(1);
        _MainMenu   = new List <Button>();
        _AttackMenu = new List <Button>();
        _HealMenu   = new List <Button>();
        _VolMenu    = new List <Button>();
        _MessageBox = new Button {
            X = 0, Y = 0, Caption = "", Width = 0, Height = 0
        };
        _ActiveMenu = Menu.MainMenu;
        _soundLevel = 0.5F;

        CreateMainMenu();
        CreateAttackMenu();
        CreateHealMenu();
        CreateVolButtons();

        //Main Buttons
        _AttackButton.OnClick  += (btn) => _ActiveMenu = Menu.AttackMenu;
        _HealButton.OnClick    += (btn) => _ActiveMenu = Menu.HealMenu;
        _CounterButton.OnClick += (btn) => Counter(_Player);
        _QuitButton.OnClick    += (btn) => _Quit = true;

        //Attack Buttons
        _ChargeButton.OnClick     += (btn) => Charge(_Player, _Enemy);
        _SlashButton.OnClick      += (btn) => Slash(_Player, _Enemy);
        _SpellButton.OnClick      += (btn) => Spell(_Player, _Enemy);
        _AttackBackButton.OnClick += (btn) => _ActiveMenu = Menu.MainMenu;

        //HealButtons

        _PotionButton.OnClick   += (btn) => PotionHeal(_Player);
        _MagicButton.OnClick    += (btn) => MagicHeal(_Player);
        _HealBackButton.OnClick += (btn) => _ActiveMenu = Menu.MainMenu;

        //Volume Buttons
        _VolumeUp.OnClick   += (btn) => ChangeVolume(0.1F);
        _VolumeDown.OnClick += (btn) => ChangeVolume(-0.1F);
        SplashKit.PlayMusic(_Music, 8, _soundLevel);

        //instructions button
        _InstructionsCloseButton = new Button {
            X = gameWindow.Width - 300, Y = 0, Caption = "Instructions", Width = 150, Height = 30
        };
        _InstructionsCloseButton.OnClick += (btn) => ToggleInstructions();
    }
コード例 #47
0
 void Start()
 {
     music = GameObject.FindObjectOfType <Music>();
     UpdateIcon();
 }
コード例 #48
0
 public static void CheckAndPlaySong(Music music)
 {
     CheckAndPlaySong(music, true);
 }
コード例 #49
0
 public SceneDefinition(Location location, Time time, Music music)
 {
     this.Location = location;
     this.Time     = time;
     this.Music    = music;
 }
コード例 #50
0
ファイル: Select.cs プロジェクト: Namisato-Shohei/-Unity
 public void OnClickCake()
 {
     Music.MusicPlay1();
     GoalName = "Sample";
     SceneManager.LoadScene("Goal");
 }
コード例 #51
0
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (ProfilePopup.Visibility == Visibility.Hidden)
            {
                switch (e.Key)
                {
                case Key.Right:
                    if (currentButtonSelectionIndex != 2 && currentButtonSelectionIndex != 5 && currentButtonSelectionIndex != 8 && currentButtonSelectionIndex != 9)
                    {
                        resetButtonFocus(currentButtonSelectionIndex);
                        currentButtonSelectionIndex = (currentButtonSelectionIndex + 1) % 9;
                        setButtonFocus(currentButtonSelectionIndex);
                    }

                    break;

                case Key.Left:
                    if (currentButtonSelectionIndex != 0 && currentButtonSelectionIndex != 3 && currentButtonSelectionIndex != 6 && currentButtonSelectionIndex != 9)
                    {
                        resetButtonFocus(currentButtonSelectionIndex);
                        currentButtonSelectionIndex = (currentButtonSelectionIndex - 1) % 9;
                        setButtonFocus(currentButtonSelectionIndex);
                    }

                    break;

                case Key.Down:
                    if (currentButtonSelectionIndex == 9)
                    {
                        resetButtonFocus(currentButtonSelectionIndex);
                        currentButtonSelectionIndex = 0;
                        setButtonFocus(currentButtonSelectionIndex);
                    }
                    else if (currentButtonSelectionIndex < 6)
                    {
                        resetButtonFocus(currentButtonSelectionIndex);
                        currentButtonSelectionIndex = (currentButtonSelectionIndex + 3) % 9;
                        setButtonFocus(currentButtonSelectionIndex);
                    }

                    break;

                case Key.Up:
                    if (currentButtonSelectionIndex >= 3 && currentButtonSelectionIndex != 9)
                    {
                        resetButtonFocus(currentButtonSelectionIndex);
                        currentButtonSelectionIndex = (currentButtonSelectionIndex - 3) % 9;
                        setButtonFocus(currentButtonSelectionIndex);
                    }
                    else
                    {
                        resetButtonFocus(currentButtonSelectionIndex);
                        currentButtonSelectionIndex = 9;
                        setButtonFocus(currentButtonSelectionIndex);
                    }
                    break;

                case Key.Z:
                    if (e.Key == Key.Z)
                    {     //hardcoded to show notification
                        Notification_popup0.Visibility = Visibility.Visible;
                        notifyDot.Visibility           = Visibility.Visible;
                        dispatcherTimer.Start();
                    }
                    break;

                case Key.S:
                    Settings settings = new Settings();
                    settings.Show();
                    this.Close();
                    break;

                case Key.G:
                    TV_Guide tv = new TV_Guide();
                    tv.Show();
                    this.Close();
                    break;

                case Key.OemQuestion:
                    Settings setting = new Settings();
                    setting.Show();
                    this.Close();
                    break;

                case Key.OemPlus:
                    Vol1.Visibility = Visibility.Visible;
                    Vol2.Visibility = Visibility.Visible;
                    Vol.Visibility  = Visibility.Visible;
                    volume         += 2;
                    Vol.Content     = volume;
                    if (volume >= 45 && volume < 50)
                    {
                        Vol2.Margin = new Thickness(724, 368, 0, 0);
                    }
                    if (volume >= 50)
                    {
                        Vol2.Margin = new Thickness(697, 377, 0, 0);
                    }
                    dispatcherTimer.Start();
                    break;

                case Key.OemMinus:
                    Vol1.Visibility = Visibility.Visible;
                    Vol2.Visibility = Visibility.Visible;
                    Vol.Visibility  = Visibility.Visible;
                    volume         -= 2;
                    Vol.Content     = volume;
                    if (volume >= 45 && volume < 50)
                    {
                        Vol2.Margin = new Thickness(724, 368, 0, 0);
                    }
                    if (volume < 45)
                    {
                        Vol2.Margin = new Thickness(742, 351, 0, 0);
                    }
                    dispatcherTimer.Start();
                    break;

                case Key.O:
                    /*{ "Live TV", "Image/tv_icon.png" }, { "Gallery", "Image/gallery_icon.png" }, { "Music", "Image/music_icon.png" }, { "Recordings", "Image/record_icon.png" }, { "Search", "Image/search_icon.jpg" }, { "Netflix", "Image/netflix_icon.png" }, { "Settings", "Image/settings_icon.png" }, { "Notification", "Image/notification_icon.png" }, { "Other Apps", "Image/apps_icon.png" } , {"John Doe","Image/profile_icon.png" }*/
                    if (Notification_popup0.Visibility != Visibility.Visible)
                    {
                        bool dontClose = false;
                        resetButtonFocus(currentButtonSelectionIndex);
                        switch (content[currentButtonSelectionIndex, 0])
                        {
                        case "Live TV":
                            TV_Guide tvG = new TV_Guide();
                            tvG.Show();
                            break;

                        case "Gallery":
                            Photos_Videos gallery = new Photos_Videos();
                            gallery.Show();
                            break;

                        case "Music":
                            Music music = new Music();
                            music.Show();
                            break;

                        case "Recordings":
                            Recordings rec = new Recordings();
                            rec.Show();
                            break;

                        case "Search":
                            Search search = new Search();
                            search.Show();
                            break;

                        case "Netflix":
                            dontClose = true;
                            MessageBox.Show("No screens made for third party");
                            break;

                        case "Settings":
                            Settings sett = new Settings();
                            sett.Show();
                            break;

                        case "Notification":
                            Notification_tab notif = new Notification_tab();
                            notif.Show();
                            notifyDot.Visibility = Visibility.Hidden;
                            break;

                        case "Other Apps":
                            OtherApplications otherApp = new OtherApplications();
                            otherApp.Show();
                            content[6, 0] = "Prime Videos";
                            content[6, 1] = "Image/primevid_icon.png";
                            updateContent(6);
                            break;

                        default:            //profile
                            MainGrid.Effect = new BlurEffect();
                            dontClose       = true;
                            profileBtns.Clear();
                            ProfilePopup.Visibility    = Visibility.Visible;
                            Profiles_header.Visibility = Visibility.Visible;
                            for (int i = 0; i < 2; i++)
                            {
                                Button profile = new Button();
                                profile.HorizontalContentAlignment = HorizontalAlignment.Center;
                                StackPanel sPanel1 = new StackPanel();
                                sPanel1.HorizontalAlignment = HorizontalAlignment.Center;
                                sPanel1.Orientation         = Orientation.Vertical;
                                Image image    = new Image();
                                Uri   imageUri = new Uri(profiles[i, 1], UriKind.Relative);
                                image.Source = new BitmapImage(imageUri);
                                image.Height = 55;
                                image.Width  = 55;
                                sPanel1.Children.Add(image);
                                profile.Name = "profile" + i.ToString();
                                TextBox textBox = new TextBox();
                                textBox.Background  = Brushes.Transparent;
                                textBox.Text        = profiles[i, 0];
                                textBox.BorderBrush = Brushes.Transparent;
                                profile.Height      = 90;
                                profile.Width       = 170;
                                textBox.FontSize    = 20;
                                sPanel1.Children.Add(textBox);
                                profile.Content    = sPanel1;
                                profile.Background = (LinearGradientBrush)FindResource("ButtonNormalBackground");
                                profileBtns.Add(profile);
                                ProfilePopup.Children.Add(profile);
                            }
                            //ProfilePopup.Children.Add

                            setProfileButtonFocus(profileIndex);
                            //Console.WriteLine(profileIndex);
                            break;
                        }
                        if (!dontClose)
                        {
                            updateContent(currentButtonSelectionIndex);
                            currentButtonSelectionIndex = 0;
                            this.Close();
                        }
                    }
                    else
                    {
                        if (e.Key == Key.O)
                        {
                            LiveTV liveTV = new LiveTV(2);
                            notifyDot.Visibility = Visibility.Hidden;
                            liveTV.Show();
                            this.Close();
                        }
                    }
                    break;

                default:
                    break;
                }
            }
            else
            {
                switch (e.Key)
                {
                case Key.Back:

                    if (addingProfilePopup.Visibility == Visibility.Hidden)
                    {
                        MainGrid.Effect = null;
                        ProfilePopup.Children.Clear();
                        ProfilePopup.Visibility    = Visibility.Hidden;
                        Profiles_header.Visibility = Visibility.Hidden;
                        setButtonFocus(currentButtonSelectionIndex);
                        resetProfileButtonFocus(profileIndex);
                        profileIndex = 0;
                    }
                    else
                    {
                        ProfilePopup.Effect           = null;
                        addingProfilePopup.Visibility = Visibility.Hidden;
                        keypad.Visibility             = Visibility.Hidden;
                        BackOption.Visibility         = Visibility.Hidden;
                    }
                    break;

                case Key.Right:
                    if (addingProfilePopup.Visibility == Visibility.Hidden)
                    {
                        resetProfileButtonFocus(profileIndex);
                        profileIndex = (profileIndex + 1) % 2;
                        setProfileButtonFocus(profileIndex);
                    }
                    break;

                case Key.Left:
                    if (addingProfilePopup.Visibility == Visibility.Hidden)
                    {
                        resetProfileButtonFocus(profileIndex);
                        profileIndex = (profileIndex - 1);
                        if (profileIndex == -1)
                        {
                            profileIndex = 1;
                        }
                        setProfileButtonFocus(profileIndex);
                    }
                    break;

                case Key.O:
                    if (addingProfilePopup.Visibility == Visibility.Hidden)
                    {
                        ProfilePopup.Effect           = new BlurEffect();
                        addingProfilePopup.Visibility = Visibility.Visible;
                        keypad.Visibility             = Visibility.Visible;
                        BackOption.Visibility         = Visibility.Visible;
                    }
                    break;

                default:
                    break;
                }
            }
        }
コード例 #52
0
ファイル: Select.cs プロジェクト: Namisato-Shohei/-Unity
 public void OnClickBird()
 {
     Music.MusicPlay1();
     GoalName = "Bird";
     SceneManager.LoadScene("Goal");
 }
コード例 #53
0
        static void Main(string[] args)
        {
            // creating game window
            RenderWindow window = new RenderWindow(new VideoMode(Config.SCREEN_WIDTH, Config.SCREEN_HEIGHT), "Snake Game"); // creating window object

            window.SetFramerateLimit(Config.FRAME_RATE);                                                                    // setting fps limit

            window.Closed += new EventHandler(OnClose);                                                                     // registering OnClose function as a callback function
                                                                                                                            // whenever window.Closed event occurs

            // creating resources object for game manipulation
            MainMenu           menu            = new MainMenu(ref window);
            Snake              snake           = new Snake(ref window);
            SnakeFood          food            = new SnakeFood(ref window);
            Score              score           = new Score(ref window);
            CollisionDetection collision       = new CollisionDetection();
            Music              BackgroundMusic = new Music(Config.BACKGROUND_MUSIC);

            BackgroundMusic.Loop = true;
            BackgroundMusic.Play();
            int ScoreCounter = 0;

            // ActivityNumber tells which activity is currently need to draw
            // for example : 0 -> MainMenu, 1 -> StartGame, 2 -> HighScore, 3 -> Quit
            int  ActivityNumber = 0;
            uint Frame_Rate     = 60;

            // starting game loop, the game window is open till any closing event doesn't occurs in event stack
            while (window.IsOpen)
            {
                // processing events that occured after window gets opened
                window.DispatchEvents();
                window.Clear(Color.Black);

                //
                switch (ActivityNumber)
                {
                // 7. Use of methods
                case 0:
                    // checking keypresses
                    window.SetFramerateLimit(Config.FRAME_RATE);
                    if (Keyboard.IsKeyPressed(Keyboard.Key.Up))
                    {
                        menu.ChangeSelectionText(-1);
                    }
                    else if (Keyboard.IsKeyPressed(Keyboard.Key.Down))
                    {
                        menu.ChangeSelectionText(1);
                    }
                    else if (Keyboard.IsKeyPressed(Keyboard.Key.Return))
                    {
                        ActivityNumber = menu.CurrentSelection + 1;
                    }
                    // drawing menu over window
                    menu.draw();
                    break;

                case 1:
                    // starting snake game
                    window.SetFramerateLimit(Frame_Rate);
                    window.Clear(Color.Black);
                    if (Keyboard.IsKeyPressed(Keyboard.Key.Up))
                    {
                        snake.ChangeDirection(Config.UP);
                    }
                    else if (Keyboard.IsKeyPressed(Keyboard.Key.Down))
                    {
                        snake.ChangeDirection(Config.DOWN);
                    }
                    else if (Keyboard.IsKeyPressed(Keyboard.Key.Left))
                    {
                        snake.ChangeDirection(Config.LEFT);
                    }
                    else if (Keyboard.IsKeyPressed(Keyboard.Key.Right))
                    {
                        snake.ChangeDirection(Config.RIGHT);
                    }
                    else if (Keyboard.IsKeyPressed(Keyboard.Key.Escape))
                    {
                        ActivityNumber = 0;
                    }

                    if (collision.IsCollide(food.GetPosition(), snake.getPositionOfHead()))
                    {
                        snake.ChangeLength(10);
                        ScoreCounter += 10;
                        Frame_Rate   += 10;
                        Console.WriteLine(Frame_Rate);
                        food.RandomizeFoodPosition();
                        window.SetFramerateLimit(Frame_Rate);
                    }

                    if (snake.isSnakeEatsItself())
                    {
                        // 5. Writing Data to simple text file
                        score.WriteScore(ScoreCounter);
                        Text GameOver = new Text("Game Over", new Font(Config.ARCADE_CLASSIC_FONT), 150);
                        GameOver.Position  = new Vector2f(70, Config.SCREEN_HEIGHT / 2 - 150);
                        GameOver.FillColor = Color.Cyan;
                        window.Draw(GameOver);
                        window.Display();
                        System.Threading.Thread.Sleep(2000);
                        ActivityNumber = 0;
                        break;
                    }

                    snake.move();
                    snake.draw();
                    food.Draw();
                    break;

                case 2:
                    // displaying high score
                    if (Keyboard.IsKeyPressed(Keyboard.Key.Escape))
                    {
                        ActivityNumber = 0;
                    }
                    score.Draw();
                    break;

                case 3:
                    // quitting game window
                    window.Close();
                    break;
                }

                window.Display();
            }
        }
コード例 #54
0
ファイル: Select.cs プロジェクト: Namisato-Shohei/-Unity
 public void OnClicChair()
 {
     Music.MusicPlay1();
     GoalName = "Chair";
     SceneManager.LoadScene("Goal");
 }
コード例 #55
0
        /// <summary>
        /// 楽曲マスタとスコアデータを登録する。
        /// </summary>
        /// <param name="music">Musicオブジェクト</param>
        /// <returns>true:登録成功、false:登録失敗</returns>
        public bool InsertOrReplace(Music music)
        {
            // return value initialized with false
            bool result = false;

            logger.Info("Music dao insert or replace start.");
            logger.Info("Target music data = " + Music.ToJsonString(music));

            // database access section
            using (SqliteConnection connection = new SqliteConnection(builder.ToString()))
            {
                // connection open
                connection.Open();

                // enable transaction
                using (SqliteTransaction transaction = connection.BeginTransaction())
                    using (SqliteCommand command = connection.CreateCommand())
                    {
                        /** Section.1 - Music data **/
                        logger.Info("Section.1 music data insert/replace start.");

                        // If music.id == null -> insert, else -> update
                        if (music.id == null)
                        {
                            logger.Info("Music master data is exists, insert music master data.");

                            // SQL
                            command.CommandText = "INSERT INTO M_MUSIC(title, difficult, level, insert_date, update_date) VALUES (@title, @difficult, @level, datetime('now', 'localtime'), datetime('now', 'localtime'));";

                            // query to log
                            logger.Info(command.CommandText);

                            // prepared statement
                            command.Parameters.AddWithValue("difficult", music.difficult);
                            command.Parameters.AddWithValue("title", music.title);
                            command.Parameters.AddWithValue("level", music.level);

                            // execute
                            command.ExecuteNonQuery();

                            // clear parameters
                            command.Parameters.Clear();

                            logger.Info("Get music id.");

                            // SQL
                            command.CommandText = "SELECT id FROM M_MUSIC WHERE rowid = last_insert_rowid();";

                            // query to log
                            logger.Info(command.CommandText);

                            // check music is still exists?
                            using (SqliteDataReader reader = command.ExecuteReader())
                            {
                                while (reader.Read() == true)
                                {
                                    music.id = GetInt(0, reader);
                                }
                            }

                            // Inserted Music id check
                            if (music.id == null)
                            {
                                logger.Error("Can't get inserted music id!");
                                result = false;
                                return(result);
                            }
                            else
                            {
                                logger.Info("Inserted music id = " + music.id);
                            }

                            // clear parameters
                            command.Parameters.Clear();
                        }
                        else
                        {
                            logger.Info("Music master data is exists, update music master data. Music id = " + music.id);

                            // SQL
                            command.CommandText = "UPDATE M_MUSIC SET title = @title, difficult = @difficult, level = @level, update_date = datetime('now', 'localtime') WHERE id = @id;";

                            // query to log
                            logger.Info(command.CommandText);

                            // prepared statement
                            command.Parameters.AddWithValue("id", music.id);
                            command.Parameters.AddWithValue("difficult", music.difficult);
                            command.Parameters.AddWithValue("title", music.title);
                            command.Parameters.AddWithValue("level", music.level);

                            // execute
                            command.ExecuteNonQuery();

                            // clear parameters
                            command.Parameters.Clear();
                        }

                        logger.Info("Section 1. music data insert/replace end.");

                        /** Section.2 - Score data**/
                        logger.Info("Section 2. score data insert start.");

                        foreach (ScoreResult scoreResult in music.scoreResultList)
                        {
                            // If scoreReuslt.id == null -> insert, else == update
                            if (scoreResult.id == null)
                            {
                                logger.Info("Score result data is exists, insert score result data.");

                                // SQL
                                command.CommandText = "INSERT INTO T_SCORE_RECORD(music_id, perfect, great, good, bad, miss, total_notes, max_combo, ex_score, score, image_file_path, insert_date, update_date) VALUES (@music_id, @perfect, @great, @good, @bad, @miss, @total_notes, @max_combo, @ex_score, @score, @image_file_path, datetime('now', 'localtime'), datetime('now', 'localtime'));";

                                // query to log
                                logger.Info(command.CommandText);

                                logger.Info("Target data = title : " + music.title + ", ex_score : " + scoreResult.exScore);
                                command.Parameters.AddWithValue("music_id", music.id);
                                command.Parameters.AddWithValue("perfect", scoreResult.perfect);
                                command.Parameters.AddWithValue("great", scoreResult.great);
                                command.Parameters.AddWithValue("good", scoreResult.good);
                                command.Parameters.AddWithValue("bad", scoreResult.bad);
                                command.Parameters.AddWithValue("miss", scoreResult.miss);
                                command.Parameters.AddWithValue("total_notes", scoreResult.totalNotes);
                                command.Parameters.AddWithValue("max_combo", scoreResult.maxCombo);
                                command.Parameters.AddWithValue("ex_score", scoreResult.exScore);
                                command.Parameters.AddWithValue("score", scoreResult.score);
                                command.Parameters.AddWithValue("image_file_path", scoreResult.imageFilePath);

                                // execute
                                command.ExecuteNonQuery();

                                // clear parameters
                                command.Parameters.Clear();
                            }
                            else
                            {
                                logger.Info("Score result data is exists, update Score result data. Score Result id = " + scoreResult.id);

                                // SQL
                                command.CommandText = "UPDATE T_SCORE_RECORD SET perfect = @perfect, great = @great, good = @good, bad = @bad, miss = @miss, total_notes = @total_notes, max_combo = @max_combo, ex_score = @ex_score, score = @score, image_file_path = @image_file_path WHERE id = @id;";

                                // query to log
                                logger.Info(command.CommandText);
                                logger.Info("Target data = id : " + scoreResult.id + ", ex_score : " + scoreResult.exScore);
                                command.Parameters.AddWithValue("perfect", scoreResult.perfect);
                                command.Parameters.AddWithValue("great", scoreResult.great);
                                command.Parameters.AddWithValue("good", scoreResult.good);
                                command.Parameters.AddWithValue("bad", scoreResult.bad);
                                command.Parameters.AddWithValue("miss", scoreResult.miss);
                                command.Parameters.AddWithValue("total_notes", scoreResult.totalNotes);
                                command.Parameters.AddWithValue("max_combo", scoreResult.maxCombo);
                                command.Parameters.AddWithValue("ex_score", scoreResult.exScore);
                                command.Parameters.AddWithValue("score", scoreResult.score);
                                command.Parameters.AddWithValue("image_file_path", scoreResult.imageFilePath);
                                command.Parameters.AddWithValue("id", scoreResult.id);

                                // execute
                                if (command.ExecuteNonQuery() == 1)
                                {
                                    logger.Info("Update result is ok.");
                                }
                                else
                                {
                                    logger.Info("Update result NG!");
                                    throw new SqliteException("Update count is ng, not 1.", 5000);
                                }

                                // clear parameters
                                command.Parameters.Clear();
                            }
                        }

                        logger.Info("Section 2. score data insert end.");

                        /** Section.3 Update Hashed OCR data **/
                        logger.Info("Section 3. hashed ocr data insert start.");

                        if (music.hashedOcrData == null ||
                            music.hashedOcrData == string.Empty ||
                            music.hashedOcrDataList.Contains(music.hashedOcrData) == true)
                        {
                            logger.Info("No need to insert hashed ocr data.");
                        }
                        else
                        {
                            // SQL
                            command.CommandText = "INSERT INTO T_OCRREAD_MUSIC_LINK(music_id, hashed_ocr_data) VALUES (@music_id, @hashed_ocr_data);";

                            // query to log
                            logger.Info(command.CommandText);

                            // prepared statement
                            command.Parameters.AddWithValue("music_id", music.id);
                            command.Parameters.AddWithValue("hashed_ocr_data", music.hashedOcrData);

                            // execute
                            command.ExecuteNonQuery();

                            // clear parameters
                            command.Parameters.Clear();

                            // update music object
                            music.hashedOcrDataList.Add(music.hashedOcrData);
                        }

                        // commit
                        transaction.Commit();

                        // successful all command
                        result = true;
                    }
            }

            logger.Info("Music dao insert or replace end.");

            return(result);
        }
コード例 #56
0
ファイル: Select.cs プロジェクト: Namisato-Shohei/-Unity
 public void ButtonClick(string text)
 {
     Music.MusicPlay1();
     GoalName = text;
     SceneManager.LoadScene("Goal");
 }
コード例 #57
0
        /// <summary>
        /// 曲名、Level、難易度をもとに楽曲マスタと、それに紐づくOCRデータ、および、スコアデータを検索
        /// </summary>
        /// <param name="musicId">楽曲マスタのID</param>
        /// <returns>IDに一致するMusicオブジェクト</returns>
        public Music selectByTitleDifficultLevel(string title, int level, string difficult)
        {
            // return value
            Music music = null;

            // Music id value
            int?musicId = null;

            logger.Info("Music dao select by title & level & difficult start.");
            logger.Info("Title = " + title + ", Level = " + level + ", Difficult = " + difficult);

            // database access section
            using (SqliteConnection connection = new SqliteConnection(builder.ToString()))
            {
                // connection open
                connection.Open();

                // enable transaction
                using (SqliteTransaction transaction = connection.BeginTransaction())
                    using (SqliteCommand command = connection.CreateCommand())
                    {
                        // Select Music ID from Hashed OCR Data
                        // SQL
                        command.CommandText = "SELECT id, title, level, difficult FROM M_MUSIC WHERE title = @title AND level = @level AND difficult = @difficult";

                        // query to log
                        logger.Info(command.CommandText);

                        // prepared statement
                        command.Parameters.AddWithValue("title", title);
                        command.Parameters.AddWithValue("level", level);
                        command.Parameters.AddWithValue("difficult", difficult);

                        // check music is still exists?
                        using (SqliteDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read() == true)
                            {
                                musicId = GetInt(0, reader);
                                logger.Info("Selected music id = " + musicId);
                            }
                        }
                        // clear parameters
                        command.Parameters.Clear();
                    }
            }

            // if no selected record, return null
            if (musicId == null)
            {
                logger.Info("Music ID is not selected, return null.");
            }
            else
            {
                logger.Info("Music ID is selected, search data. Call another function.");
                music = selectByMusicId(musicId);
            }

            logger.Info("Music dao select by title & level & difficult end.");

            return(music);
        }
コード例 #58
0
        private void ExportMusics(Document doc)
        {
            try
            {
                WriteChapter(doc, "Musics");
                IList items = MusicServices.Gets();

                PdfPTable mainTable = new PdfPTable(1);

                for (int i = 0; i < items.Count; i++)
                {
                    Music entity = items[i] as Music;

                    CommonServices.GetChild(entity);

                    if (_isCancelationPending == true)
                    {
                        break;
                    }

                    if (entity != null)
                    {
                        Ressource cover = entity.Ressources.FirstOrDefault(x => x.IsDefault == true);
                        byte[]    image = null;

                        if (cover != null)
                        {
                            image = cover.Value;
                        }

                        PdfPTable table = WriteCover(image, entity.Title);

                        StringBuilder types = new StringBuilder();
                        foreach (Artist item in entity.Artists)
                        {
                            if (types.Length == 0)
                            {
                                types.Append(item.FulleName);
                            }
                            else
                            {
                                types.Append("," + item.FulleName);
                            }
                        }

                        string editorName = string.Empty;
                        if (entity.Publisher != null)
                        {
                            editorName = entity.Publisher.Name;
                        }

                        PdfPTable text = WriteFirstRow(entity.Title, types.ToString(), editorName);

                        DateTime releasedate = DateTime.MinValue;
                        if (entity.ReleaseDate != null)
                        {
                            releasedate = (DateTime)entity.ReleaseDate;
                        }

                        int rating = 0;
                        if (entity.MyRating != null)
                        {
                            rating = (int)entity.MyRating;
                        }

                        WriteSecondRow(releasedate, rating, text);
                        WriteDescription(entity.Comments, text);

                        types = new StringBuilder();
                        foreach (Genre item in entity.Genres)
                        {
                            if (types.Length == 0)
                            {
                                types.Append(item.DisplayName);
                            }
                            else
                            {
                                types.Append("," + item.DisplayName);
                            }
                        }

                        WriteTypeRow(types.ToString(), entity.AddedDate.ToShortDateString(), text);

                        string media = string.Empty;
                        if (entity.Media != null)
                        {
                            media = entity.Media.Name;
                        }
                        WriteMediaInfo(media, entity.FilePath, entity.FileName, text);

                        table.AddCell(text);
                        //table.SplitRows = false;

                        PdfPCell cell = new PdfPCell(table);
                        cell.Border      = 0;
                        cell.BorderColor = iTextSharp.text.BaseColor.WHITE;

                        mainTable.AddCell(cell);
                    }

                    _intAddedItem++;
                    Current++;
                    items[i] = null;
                }
                doc.Add(mainTable);

                doc.NewPage();
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
                throw;
            }
        }
コード例 #59
0
ファイル: Program.cs プロジェクト: PerxodiT/SFML_MazeWalker
        static void Main(string[] args)
        {
            Settings.Load();

            Init();

            float FPS    = 0;
            int   fcount = 0;

            map    = new Map();
            player = new Player(map);

            Text fps = new Text(FPS.ToString(), new Font(Resources.FPS_Font));

            fps.FillColor = Color.Red;
            fps.Position  = new Vector2f(Settings.sWidth - 50, 10);


            ingame   = new Music(Resources.ingame_music);
            inmenu   = new Music(Resources.menu_music);
            stepsbuf = new SoundBuffer(Resources.steps);
            steps    = new Sound(stepsbuf);

            buttonbuf = new SoundBuffer(Resources.button);
            button    = new Sound(buttonbuf);

            steps.Loop  = true;
            ingame.Loop = true;
            inmenu.Loop = true;

            menu = new Menu();
            menu.OnOpen();

            Text debug = new Text($"Время расчета: {player.CalcTime.TotalMilliseconds}\nВремя отрисовки: {player.DrawTime.TotalMilliseconds}", new Font(Resources.FPS_Font));

            debug.Position  = new Vector2f(50, Settings.sHeight - 400);
            debug.FillColor = Color.Magenta;

            Settings.Update(true);

            while (window.IsOpen)
            {
                window.SetVerticalSyncEnabled(Settings.VSync);
                window.SetFramerateLimit(Settings.FPS_Limit);
                fps.Position = new Vector2f(Settings.sWidth - 50, 10);

                if (Exit)
                {
                    window.Close();
                }
                fcount++;
                DateTime start = DateTime.Now;
                fps.DisplayedString = ((int)FPS).ToString();
                window.DispatchEvents();

                if (player.Stamina > 1)
                {
                    player.Stamina = 1;
                }
                if (player.Stamina < 0)
                {
                    player.Stamina = 0;
                }
                Joystick.Update();
                if (!Joystick.IsConnected(0))
                {
                    if (Keyboard.IsKeyPressed(Keyboard.Key.RShift) || Keyboard.IsKeyPressed(Keyboard.Key.LShift))
                    {
                        player.Run();
                    }
                    else
                    {
                        player.Stamina += player.Stamina < 1 ? 0.0025F : 0;
                    }
                    if (Keyboard.IsKeyPressed(Keyboard.Key.W))
                    {
                        if (steps.Status != SoundStatus.Playing && Keyboard.IsKeyPressed(Keyboard.Key.W))
                        {
                            steps.Play();
                        }
                        player.Walk(Keyboard.Key.W, frametime);
                    }
                    if (Keyboard.IsKeyPressed(Keyboard.Key.A))
                    {
                        if (steps.Status != SoundStatus.Playing && Keyboard.IsKeyPressed(Keyboard.Key.A))
                        {
                            steps.Play();
                        }
                        player.Walk(Keyboard.Key.A, frametime);
                    }
                    if (Keyboard.IsKeyPressed(Keyboard.Key.S))
                    {
                        if (steps.Status != SoundStatus.Playing && Keyboard.IsKeyPressed(Keyboard.Key.S))
                        {
                            steps.Play();
                        }
                        player.Walk(Keyboard.Key.S, frametime);
                    }
                    if (Keyboard.IsKeyPressed(Keyboard.Key.D))
                    {
                        if (steps.Status != SoundStatus.Playing && Keyboard.IsKeyPressed(Keyboard.Key.D))
                        {
                            steps.Play();
                        }
                        player.Walk(Keyboard.Key.D, frametime);
                    }
                }
                else
                {
                    player.JoystickTurn();
                    player.JoystickWalk(frametime);

                    if (Joystick.IsButtonPressed(0, 5))
                    {
                        player.Run();
                    }
                    else
                    {
                        player.Stamina += player.Stamina < 1 ? 0.0025F : 0;
                    }
                }
                if (Keyboard.IsKeyPressed(Keyboard.Key.F1))
                {
                    Help();
                }


                window.Clear(Color.White);
                window.SetMouseCursorVisible(isMenu);
                //Drawing
                if (menu.isWin)
                {
                    EndScene();
                }
                if (isMenu)
                {
                    menu.Draw(window);
                }
                else
                {
                    inmenu.Stop();
                    player.Draw(window);
                    map.Draw(window);
                    player.DrawOnMap(window);
                }
                //====================



                if (fcount == 20)
                {
                    debug.DisplayedString = $"" +
                                            $"Joystick.Axis.Y = {MathF.Round(Joystick.GetAxisPosition(0, Joystick.Axis.Z) / 100F, 4)}\n" +
                                            $"Joystick.Axis.X = {Joystick.IsButtonPressed(0, 6)}\n" +
                                            $"Test = {TEST}\n";
                }

                window.Draw(debug);
                window.Draw(fps);
                window.Display();


                frametime = (DateTime.Now - start).TotalSeconds;
                if (fcount == 20)
                {
                    FPS    = (float)(1 / frametime);
                    fcount = 0;
                    window.Draw(debug);
                }
            }
        }
コード例 #60
0
ファイル: MusicManager.cs プロジェクト: wtfcolt/game
        /// <summary>
        /// Plays a music track by the given <see cref="MusicID"/>.
        /// </summary>
        /// <param name="id">The ID of the music to play.</param>
        /// <returns>
        /// True if the music played successfully; otherwise false.
        /// </returns>
        public bool Play(MusicID id)
        {
            try
            {
                // If the music is already playing, continue to play it
                if (_playingInfo != null && _playingInfo.ID == id)
                {
                    if (_playing.Status != SoundStatus.Playing)
                    {
                        _playing.Play();
                    }

                    return(true);
                }

                // Stop the old music
                Stop();

                // Get the info for the music to play
                var info = GetMusicInfo(id);
                if (info == null)
                {
                    return(false);
                }

                // Start the new music
                _playingInfo = info;

                var file = GetFilePath(info);
                try
                {
                    _playing = new Music(file);
                }
                catch (LoadingFailedException ex)
                {
                    const string errmsg = "Failed to load music `{0}`: {1}";
                    if (log.IsErrorEnabled)
                    {
                        log.ErrorFormat(errmsg, info, ex);
                    }
                    Debug.Fail(string.Format(errmsg, info, ex));

                    _playing     = null;
                    _playingInfo = null;

                    return(false);
                }

                // Set the values for the music and start playing it
                _playing.Volume             = Volume;
                _playing.Loop               = Loop;
                _playing.RelativeToListener = true;
                _playing.Play();
            }
            catch (Exception ex)
            {
                const string errmsg = "Failed to play music with ID `{0}`. Exception: {1}";
                if (log.IsErrorEnabled)
                {
                    log.ErrorFormat(errmsg, id, ex);
                }
                Debug.Fail(string.Format(errmsg, id, ex));
            }

            return(true);
        }