private void Initialize()
 {
     SystemEvents.UpdateTimerTick += UpdateTimerTick;
     Sound = new MediaPlayer();
     Sound.IsShuffle = true;
     Sound.MediaEnded += Sound_MediaEnded;
     SoundPath = "";
 }
        public SyncBGMPlayer()
        {
            _mp = new MediaPlayer();

            if ( !_mp.IsAvailable )
                Utility.Logger.Add( 3, "Windows Media Player のロードに失敗しました。音声の再生はできません。" );

            _mp.AutoPlay = false;

            _isBoss = false;

            Enabled = false;
            Handles = new IDDictionary<SoundHandle>();

            foreach ( SoundHandleID id in Enum.GetValues( typeof( SoundHandleID ) ) )
                Handles.Add( new SoundHandle( id ) );

            #region API register
            APIObserver o = APIObserver.Instance;

            o["api_port/port"].ResponseReceived += PlayPort;

            o["api_req_map/start"].ResponseReceived += PlaySortie;
            o["api_req_map/next"].ResponseReceived += PlaySortie;

            o["api_req_sortie/battle"].ResponseReceived += PlayBattleDay;
            o["api_req_combined_battle/battle"].ResponseReceived += PlayBattleDay;
            o["api_req_combined_battle/battle_water"].ResponseReceived += PlayBattleDay;

            o["api_req_battle_midnight/battle"].ResponseReceived += PlayBattleNight;
            o["api_req_battle_midnight/sp_midnight"].ResponseReceived += PlayBattleNight;
            o["api_req_combined_battle/midnight_battle"].ResponseReceived += PlayBattleNight;
            o["api_req_combined_battle/sp_midnight"].ResponseReceived += PlayBattleNight;

            o["api_req_sortie/airbattle"].ResponseReceived += PlayBattleAir;
            o["api_req_combined_battle/airbattle"].ResponseReceived += PlayBattleAir;
            o["api_req_sortie/ld_airbattle"].ResponseReceived += PlayBattleAir;
            o["api_req_combined_battle/ld_airbattle"].ResponseReceived += PlayBattleAir;

            o["api_req_practice/battle"].ResponseReceived += PlayPracticeDay;

            o["api_req_practice/midnight_battle"].ResponseReceived += PlayPracticeNight;

            o["api_req_sortie/battleresult"].ResponseReceived += PlayBattleResult;
            o["api_req_combined_battle/battleresult"].ResponseReceived += PlayBattleResult;
            o["api_req_practice/battle_result"].ResponseReceived += PlayBattleResult;

            o["api_get_member/record"].ResponseReceived += PlayRecord;

            o["api_get_member/payitem"].ResponseReceived += PlayItem;

            o["api_get_member/questlist"].ResponseReceived += PlayQuest;

            o["api_get_member/picture_book"].ResponseReceived += PlayAlbum;

            o["api_req_kousyou/remodel_slotlist"].ResponseReceived += PlayImprovementArsenal;

            #endregion

            Configuration.Instance.ConfigurationChanged += ConfigurationChanged;
            SystemEvents.SystemShuttingDown += SystemEvents_SystemShuttingDown;
        }
Esempio n. 3
0
        public SyncBGMPlayer()
        {
            _mp = new MediaPlayer();

            if (!_mp.IsAvailable)
            {
                Utility.Logger.Add(3, "Windows Media Player のロードに失敗しました。音声の再生はできません。");
            }

            _mp.AutoPlay  = false;
            _mp.IsShuffle = true;

            _currentSoundHandleID = (SoundHandleID)(-1);
            _isBoss = false;


            Enabled = false;
            Handles = new IDDictionary <SoundHandle>();

            foreach (SoundHandleID id in Enum.GetValues(typeof(SoundHandleID)))
            {
                Handles.Add(new SoundHandle(id));
            }



            #region API register
            APIObserver o = APIObserver.Instance;

            o["api_port/port"].ResponseReceived += PlayPort;

            o["api_req_map/start"].ResponseReceived += PlaySortie;
            o["api_req_map/next"].ResponseReceived  += PlaySortie;

            o["api_req_sortie/battle"].ResponseReceived                     += PlayBattleDay;
            o["api_req_combined_battle/battle"].ResponseReceived            += PlayBattleDay;
            o["api_req_combined_battle/battle_water"].ResponseReceived      += PlayBattleDay;
            o["api_req_combined_battle/ec_battle"].ResponseReceived         += PlayBattleDay;
            o["api_req_combined_battle/each_battle"].ResponseReceived       += PlayBattleDay;
            o["api_req_combined_battle/each_battle_water"].ResponseReceived += PlayBattleDay;

            o["api_req_battle_midnight/battle"].ResponseReceived             += PlayBattleNight;
            o["api_req_battle_midnight/sp_midnight"].ResponseReceived        += PlayBattleNight;
            o["api_req_sortie/night_to_day"].ResponseReceived                += PlayBattleNight;
            o["api_req_combined_battle/midnight_battle"].ResponseReceived    += PlayBattleNight;
            o["api_req_combined_battle/sp_midnight"].ResponseReceived        += PlayBattleNight;
            o["api_req_combined_battle/ec_midnight_battle"].ResponseReceived += PlayBattleNight;
            o["api_req_combined_battle/ec_night_to_day"].ResponseReceived    += PlayBattleNight;

            o["api_req_sortie/airbattle"].ResponseReceived             += PlayBattleAir;
            o["api_req_combined_battle/airbattle"].ResponseReceived    += PlayBattleAir;
            o["api_req_sortie/ld_airbattle"].ResponseReceived          += PlayBattleAir;
            o["api_req_combined_battle/ld_airbattle"].ResponseReceived += PlayBattleAir;

            o["api_req_practice/battle"].ResponseReceived += PlayPracticeDay;

            o["api_req_practice/midnight_battle"].ResponseReceived += PlayPracticeNight;

            o["api_req_sortie/battleresult"].ResponseReceived          += PlayBattleResult;
            o["api_req_combined_battle/battleresult"].ResponseReceived += PlayBattleResult;
            o["api_req_practice/battle_result"].ResponseReceived       += PlayBattleResult;

            o["api_get_member/record"].ResponseReceived += PlayRecord;

            o["api_get_member/payitem"].ResponseReceived += PlayItem;

            o["api_get_member/questlist"].ResponseReceived += PlayQuest;

            o["api_get_member/picture_book"].ResponseReceived += PlayAlbum;

            o["api_req_kousyou/remodel_slotlist"].ResponseReceived += PlayImprovementArsenal;

            #endregion

            Configuration.Instance.ConfigurationChanged += ConfigurationChanged;
            SystemEvents.SystemShuttingDown             += SystemEvents_SystemShuttingDown;
        }