using System;
using System.Collections.Generic;
using Cute;
using Wizard;

public class SoundMgr
{
	private enum LoadType
	{
		Se,
		Bgm,
		Voice,
		TemporaryVoice,
		EnvSound
	}

	private Se m_Se;

	private Voice m_Voice;

	private Bgm m_Bgm;

	public static readonly string PREINSTALL_CUESHEET = "preinstall";

	private string PREINSTALL_ACB = "preinstall.acb";

	private string PREINSTALL_AWB = "preinstall.awb";

	private const float BGM_DEFAULT_FADEOUT_TIME = 2f;

	private const float BGM_SAME_WAIT_TIME = 1f;

	private float m_movieVolume;

	private bool m_isMovieMute;

	private bool _rejectNewSound;

	public SoundMgr()
	{
		m_Se = new Se();
		m_Bgm = new Bgm();
		m_Voice = new Voice();
		SetMovieVolume(1f);
		MovieMute(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SOUND_MUTE));
		if (!UIManager.GetInstance().ApplicationHasFocus)
		{
			OnFocus(focus: false);
		}
	}

	public void SetCueInfo()
	{
		if (!Toolbox.AudioManager.AddCueSheet(PREINSTALL_CUESHEET, PREINSTALL_ACB, "", PREINSTALL_AWB))
		{
			throw new Exception("CRI initialization failed. Make sure your cuesheet and .acb files are existed in an application folder installed.");
		}
	}

	public void AssignSe()
	{
		m_Se.Load(Se.TYPE.BREAKCARD, "se_breakcard");
		m_Se.Load(Se.TYPE.SYS_CARD_SCROLL, "se_sys_card_scroll");
		m_Se.Load(Se.TYPE.SYS_COMMON_BUTTON, "se_sys_button");
		m_Se.Load(Se.TYPE.SYS_COMMON_CANCEL, "se_sys_cancel");
		m_Se.Load(Se.TYPE.SYS_COMMON_DECIDE, "se_sys_title_start");
		m_Se.Load(Se.TYPE.SYS_TITLE_START, "se_sys_title_start");
		m_Se.Load(Se.TYPE.SYS_BTN_DECIDE, "se_sys_button");
		m_Se.Load(Se.TYPE.SYS_BTN_DECIDE_TRANS, "se_sys_button_large");
		m_Se.Load(Se.TYPE.SYS_BTN_CANCEL, "se_sys_cancel_window_1");
		m_Se.Load(Se.TYPE.SYS_BTN_CANCEL_TRANS, "se_sys_cancel");
		m_Se.Load(Se.TYPE.SYS_SWITCH_MENU, "se_sys_switch_menu");
		m_Se.Load(Se.TYPE.SYS_MENU_CARD, "se_sys_button_menu_card");
		m_Se.Load(Se.TYPE.SYS_SWITCH_MENU_CARD, "se_sys_switch_menu_card");
		m_Se.Load(Se.TYPE.SYS_TOGGLE_ON, "se_sys_button_toggle_on");
		m_Se.Load(Se.TYPE.SYS_TOGGLE_OFF, "se_sys_button_toggle_off");
		m_Se.Load(Se.TYPE.SYS_SLIDE_BTN, "se_sys_slide");
		m_Se.Load(Se.TYPE.SYS_CARD_INFO, "se_sys_cardinfo");
		m_Se.Load(Se.TYPE.SYS_DRAG_CARD, "se_sys_drag_card");
		m_Se.Load(Se.TYPE.SYS_BAR_SLIDE, "se_sys_bar_slide");
		m_Se.Load(Se.TYPE.SYS_CARD_TOUCH, "se_sys_card_touch");
		m_Se.Load(Se.TYPE.SYS_2PICK_SELECT, "se_sys_2pick_card_select");
		m_Se.Load(Se.TYPE.SYS_2PICK_BOX_OPEN, "se_sys_2pick_box_open");
		m_Se.Load(Se.TYPE.SYS_CARD_MOVE_SINGLE_1, "se_sys_card_move_single_1");
		m_Se.Load(Se.TYPE.SYS_CARD_MOVE_SINGLE_2, "se_sys_card_move_single_2");
		m_Se.Load(Se.TYPE.SYS_CARD_MOVE_SINGLE_3, "se_sys_card_move_single_3");
		m_Se.Load(Se.TYPE.SYS_MYPAGE_EVOLVE, "se_sys_mypage_evolve");
		m_Se.Load(Se.TYPE.BATTLE_START_VS, "se_sys_battle_start_vs");
		m_Se.Load(Se.TYPE.BATTLE_START_VS_ST2, "se_sys_battle_start_vs_st2");
		m_Se.Load(Se.TYPE.DRAW, "se_sys_draw");
		m_Se.Load(Se.TYPE.DRAW_CARD_OPEN_LG, "se_sys_draw_card_open_lg");
		m_Se.Load(Se.TYPE.DRAW_CARD_OPEN, "se_sys_draw_card_open");
		m_Se.Load(Se.TYPE.MULLIGAN_SELECT_REPLACE_CARD, "se_sys_mulligan_select_replace_card");
		m_Se.Load(Se.TYPE.MULLIGAN_CANCEL_REPLACE_CARD, "se_sys_mulligan_cancel_replace_card");
		m_Se.Load(Se.TYPE.MULLIGAN_DECIDE, "se_sys_mulligan_decide");
		m_Se.Load(Se.TYPE.MULLIGAN_CARD_RETURN, "se_sys_mulligan_card_return");
		m_Se.Load(Se.TYPE.SET_CARD_TO_HAND, "se_sys_set_card_to_hand");
		m_Se.Load(Se.TYPE.SYS_BREAK_CHARACTER, "se_sys_break_character");
		m_Se.Load(Se.TYPE.SYS_TURN_END, "se_sys_turn_end");
		m_Se.Load(Se.TYPE.SYS_TURN_END_CONFIRM, "se_sys_turn_end_confirm");
		m_Se.Load(Se.TYPE.SYS_CAMERA_ZOOM_OUT, "se_sys_camera_zoom_out");
		m_Se.Load(Se.TYPE.SYS_ACTUVATE_TURNEND_BUTTON, "se_sys_activate_turnend_button");
		m_Se.Load(Se.TYPE.SYS_OPEN_SEQUENCE_CARD, "se_sys_open_sequence_card");
		m_Se.Load(Se.TYPE.SYS_CMN_CARD_DRAW_4, "se_cmn_card_draw_4");
		m_Se.Load(Se.TYPE.SYS_CMN_CARD_SELECT_3, "se_cmn_card_select_3");
		m_Se.Load(Se.TYPE.SYS_CMN_CARD_RETURN_1, "se_cmn_card_return_1");
		m_Se.Load(Se.TYPE.SYS_ATTACK_ICON_1, "se_stt_state_attack_1");
		m_Se.Load(Se.TYPE.SYS_ATTACK_ICON_2, "se_stt_state_attack_2");
		m_Se.Load(Se.TYPE.SYS_ATTACK_ICON_3, "se_stt_state_attack_3");
		m_Se.Load(Se.TYPE.SYS_CMN_UI_EP_6, "se_cmn_ui_ep_6");
		m_Se.Load(Se.TYPE.SYS_DECK_CARD_MOVE_IN, "se_sys_card_move_in");
		m_Se.Load(Se.TYPE.SYS_DECK_CARD_MOVE_OUT, "se_sys_card_move_out");
		m_Se.Load(Se.TYPE.SYS_USE_RED_ETHER, "se_sys_use_redaether");
		m_Se.Load(Se.TYPE.SYS_GET_RED_ETHER, "se_sys_get_redaether");
		m_Se.Load(Se.TYPE.SYS_CARDLIST_REVERSE, "se_sys_card_move_open");
		m_Se.Load(Se.TYPE.SYS_DECK_IN, "se_sys_deck_in");
		m_Se.Load(Se.TYPE.SYS_DECK_OUT, "se_sys_deck_out");
		m_Se.Load(Se.TYPE.SYS_GIFT_ALL, "se_sys_gift_slide");
		m_Se.Load(Se.TYPE.SYS_DIALOG_OPEN, "se_sys_popup_window");
		m_Se.Load(Se.TYPE.SYS_DL_CARD_APPEAR, "se_sys_card_appear");
		m_Se.Load(Se.TYPE.SYS_CARD_INFO_SMALL, "se_sys_cardinfo_small");
		m_Se.Load(Se.TYPE.SYS_CARD_INFO_CANCEL, "se_sys_cardinfo_small_cancel");
		m_Se.Load(Se.TYPE.SYS_FEED_TEXT, "se_sys_feed_text");
		m_Se.Load(Se.TYPE.SYS_SCROLL, "se_sys_scroll");
		m_Se.Load(Se.TYPE.SYS_PROLOGUE_CHAR_APPEAR, "se_st_prologue_char_appear");
		m_Se.Load(Se.TYPE.SYS_PROLOGUE_CHAR_APPEAR_EFFECT, "se_st_prologue_char_appear_light");
		m_Se.Load(Se.TYPE.SYS_PROLOGUE_CHAR_LEAVE, "se_st_prologue_char_leave");
		m_Se.Load(Se.TYPE.SYS_MAP_CLEAR, "se_st_map_clear");
		m_Se.Load(Se.TYPE.SYS_MAP_CAMERA_MOVE, "se_st_map_camera_move");
		m_Se.Load(Se.TYPE.SYS_MAP_NEW_AREA_RELEASE, "se_st_map_new_area_release");
		m_Se.Load(Se.TYPE.SYS_MAP_CUTIN_TEXT, "se_st_map_cutin_text");
		m_Se.Load(Se.TYPE.SE_MAP_TREE_EFFECT, "se_st_map_chapter_change_01");
		m_Se.Load(Se.TYPE.SE_MAP_SECTION9_CHAPTER1, "se_st_map_chapter_change_02");
		m_Se.Load(Se.TYPE.SE_MAP_SECTION9_CHAPTER2, "se_st_map_chapter_change_03");
		m_Se.Load(Se.TYPE.SE_MAP_SECTION9_CHANGE_CHAPTER, "se_st_map_chapter_change_09");
		m_Se.Load(Se.TYPE.SE_MAP_BACKGROUND_CHANGE_FIRST_CLEAR_604, "se_st_map_chapter_change_05");
		m_Se.Load(Se.TYPE.SE_MAP_BACKGROUND_CHANGE_604, "se_st_map_chapter_change_06");
		m_Se.Load(Se.TYPE.SE_MAP_BACKGROUND_CHANGE_FIRST_CLEAR_614, "se_st_map_chapter_change_07");
		m_Se.Load(Se.TYPE.SE_MAP_CHAPTER_SELECT_FOCUS_CHANGE, "se_st_chapterselect_switch");
		m_Se.Load(Se.TYPE.SE_MAP_CHAPTER_SELECT_CLEAR, "se_st_chapterselect_clear");
		m_Se.Load(Se.TYPE.SE_MAP_CHAPTER_SELECT_CHAPTER_RELEASE, "se_st_chapterselect_new_chapter_release");
		m_Se.Load(Se.TYPE.SE_MAP_CHAPTER_SELECT_LOCKED_CHAPTER_RELEASE, "se_st_chapterselect_lock_chapter_release");
		m_Se.Load(Se.TYPE.SE_MAP_CHAPTER_SELECT_UNLOCK, "se_st_chapterselect_unlock");
		m_Se.Load(Se.TYPE.SE_MAP_SECTION20_CHANGE_CHAPTER1, "se_st_map_chapter_change_09");
		m_Se.Load(Se.TYPE.LOGIN_BONUS_STAMP_1, "se_sys_login_stamp_1");
		m_Se.Load(Se.TYPE.LOGIN_BONUS_STAMP_2, "se_sys_login_stamp_2");
		m_Se.Load(Se.TYPE.LOGIN_BONUS_STAMP_NEXT, "se_sys_login_stamp_next");
		m_Se.Load(Se.TYPE.SYS_WINDOW_MOVE, "se_sys_window_move");
		m_Se.Load(Se.TYPE.SYS_ROOM_IN, "se_sys_room_match_in");
		m_Se.Load(Se.TYPE.SYS_ROOM_OUT, "se_sys_room_match_out");
		m_Se.Load(Se.TYPE.SYS_LOTTERY_BOX_TOUCH, "se_sys_lottery_box_touch");
		m_Se.Load(Se.TYPE.SYS_BOX_OPEN_SP, "se_sys_box_open_sp_01");
		m_Se.Load(Se.TYPE.SYS_SUMMON_CARD_DROP, "se_sys_summon_card_drop");
		m_Se.Load(Se.TYPE.SYS_YOURTURN, "se_sys_yourturn");
		m_Se.Load(Se.TYPE.SYS_SUMMON_LANDING, "se_sys_summon_landing");
		m_Se.Load(Se.TYPE.SYS_ENEMY_CARD_OPEN, "se_sys_enemy_card_open");
		m_Se.Load(Se.TYPE.SYS_ENEMY_SET_CARD_TO_HAND, "se_sys_enemy_set_card_to_hand");
		m_Se.Load(Se.TYPE.SYS_ARROW_DRAG, "se_sys_arrow_drag");
		m_Se.Load(Se.TYPE.SYS_ARROW_SELECT, "se_sys_arrow_select");
		m_Se.Load(Se.TYPE.SYS_DRAG_SLIDE, "se_sys_drag_slide");
		m_Se.Load(Se.TYPE.SYS_BATTLE_EVOLVE, "se_sys_evolve");
		m_Se.Load(Se.TYPE.SYS_BATTLE_EVOLVE_SKILL, "se_cmn_card_evo_5");
		m_Se.Load(Se.TYPE.SYS_BATTLE_EVOLVE_DRAG, "se_sys_evolve_drag");
		m_Se.Load(Se.TYPE.SYS_BATTLE_EVOLVE_CUTIN, "se_sys_evolve_cutin");
		m_Se.Load(Se.TYPE.SYS_SPELL_CAST, "se_sys_spell");
		m_Se.Load(Se.TYPE.SYS_SUMMON_FALL, "se_sys_summon_fall");
		m_Se.Load(Se.TYPE.SYS_HAND_MOVE_CENTER, "se_sys_hand_move_center");
		m_Se.Load(Se.TYPE.SYS_HAND_MOVE_RIGHT, "se_sys_hand_move_right");
		m_Se.Load(Se.TYPE.SYS_BREAK_LEADER, "se_sys_break_leader");
		m_Se.Load(Se.TYPE.SYS_BREAK_LEADER_ST1, "se_sys_break_leader_st1");
		m_Se.Load(Se.TYPE.SYS_BREAK_LEADER_ST2, "se_sys_break_leader_st2");
		m_Se.Load(Se.TYPE.SYS_APPEAR_MANA, "se_sys_appear_mana_ui");
		m_Se.Load(Se.TYPE.SYS_APPEAR_LEADER, "se_sys_appear_leader_icon");
		m_Se.Load(Se.TYPE.SYS_CMN_CLASS_DECKOUT_1, "se_cmn_class_deckout_1");
		m_Se.Load(Se.TYPE.SYS_REPLAY_TURN_SKIPPING, "se_replay_turn_skipping");
		m_Se.Load(Se.TYPE.SYS_HBP_BUTTON, "se_sys_hbp_button");
		m_Se.Load(Se.TYPE.SYS_HBP_UP, "se_sys_hbp_up");
		m_Se.Load(Se.TYPE.SYS_JINGLE_WIN, "bgm_btl_jingle_win");
		m_Se.Load(Se.TYPE.SYS_JINGLE_LOSE, "bgm_btl_jingle_lose");
		m_Se.Load(Se.TYPE.SYS_RESULT_GAUGEUP, "se_sys_result_gaugeup");
		m_Se.Load(Se.TYPE.SYS_RESULT_LEVELUP, "se_sys_result_levelup");
		m_Se.Load(Se.TYPE.SYS_RESULT_RANKUP, "se_sys_result_rankup");
		m_Se.Load(Se.TYPE.SYS_RESULT_WINDOW_APPER, "se_sys_result_window_appear");
		m_Se.Load(Se.TYPE.SYS_RESULT_YOUWIN, "se_sys_result_youwin");
		m_Se.Load(Se.TYPE.SYS_RESULT_YOULOSE, "se_sys_result_youlose");
		m_Se.Load(Se.TYPE.SYS_RESULT_PUZZLE_RESET, "se_sys_puzzle_reset");
		m_Se.Load(Se.TYPE.SYS_RANK_UP_MACH_BEGIN, "se_rank_up_mach_begin");
		m_Se.Load(Se.TYPE.SYS_RANK_UP_MACH_WINDOW_MOVE, "se_rank_up_mach_window_move");
		m_Se.Load(Se.TYPE.SYS_RANK_UP_MACH_WIN, "se_rank_up_mach_win");
		m_Se.Load(Se.TYPE.SYS_RANK_UP_MACH_SUCCESS, "se_rank_up_mach_success");
		m_Se.Load(Se.TYPE.SYS_RANK_UP_MACH_LOSE, "se_rank_up_mach_lose");
		m_Se.Load(Se.TYPE.SYS_RANK_UP_MACH_FAILED, "se_rank_up_mach_failed");
		m_Se.Load(Se.TYPE.SYS_RANK_UP_MACH_RANK_DOWN, "se_rank_up_mach_rank_down");
		m_Se.Load(Se.TYPE.SYS_RANK_UP_MACH_SUCCES_2, "se_rank_up_mach_succes_2");
		m_Se.Load(Se.TYPE.SYS_BOSS_RUSH_RESULT_APPEAR, "se_sys_result_bossrush_appear");
		m_Se.Load(Se.TYPE.SYS_BOSS_RUSH_RESULT_CLEAR, "se_sys_result_bossrush_clear");
		m_Se.Load(Se.TYPE.SYS_BOSS_RUSH_RESULT_MOVE, "se_sys_result_bossrush_move");
		m_Se.Load(Se.TYPE.SYS_GACHA_LEGEND, "se_sys_gacha_legend");
		m_Se.Load(Se.TYPE.SYS_GACHA_EPIC, "se_sys_gacha_epic");
		m_Se.Load(Se.TYPE.SYS_GACHA_RARE, "se_sys_gacha_rare");
		m_Se.Load(Se.TYPE.SYS_GACHA_COMMON, "se_sys_gacha_common");
		m_Se.Load(Se.TYPE.SYS_GACHA_OPEN, "se_sys_gacha_open");
		m_Se.Load(Se.TYPE.SYS_GACHA_APPEAR, "se_sys_gacha_appear");
		m_Se.Load(Se.TYPE.SYS_GACHA_MOVE, "se_sys_gacha_move");
		m_Se.Load(Se.TYPE.SYS_GACHA_CHOICE, "se_sys_gacha_choice");
		m_Se.Load(Se.TYPE.SYS_GACHA_BACK, "se_sys_gacha_back");
		m_Se.Load(Se.TYPE.SYS_GACHA_RARE_LOOP, "se_sys_gacha_rare_loop");
		m_Se.Load(Se.TYPE.SYS_GACHA_EPIC_LOOP, "se_sys_gacha_epic_loop");
		m_Se.Load(Se.TYPE.SYS_GACHA_LEGEND_LOOP, "se_sys_gacha_legend_loop");
		m_Se.Load(Se.TYPE.SYS_GACHA_CARD_OUT, "se_sys_gacha_card_out");
		m_Se.Load(Se.TYPE.SYS_GACHA_CARD_IN, "se_sys_gacha_card_in");
		m_Se.Load(Se.TYPE.SE_SYS_WIN_REWARD_BOX_BIG, "se_sys_win_reward_box_big_1");
		m_Se.Load(Se.TYPE.SE_SYS_WIN_REWARD_BOX_SMALL, "se_sys_win_reward_box_small_1");
		m_Se.Load(Se.TYPE.SE_SYS_UPGRADE_TREASURE_BOX_01, "se_sys_upgrade_treasure_box_01");
		m_Se.Load(Se.TYPE.SE_SYS_UPGRADE_TREASURE_BOX_02, "se_sys_upgrade_treasure_box_02");
		m_Se.Load(Se.TYPE.SE_SYS_UPGRADE_TREASURE_BOX_03, "se_sys_upgrade_treasure_box_03");
		m_Se.Load(Se.TYPE.SE_SYS_UPGRADE_TREASURE_BOX_04, "se_sys_upgrade_treasure_box_04");
	}

	public void CreateBGMList()
	{
		m_Bgm.AddList(Bgm.BGM_TYPE.BATTLE_STANDBY, "bgm_btl_stand_by");
		m_Bgm.AddList(Bgm.BGM_TYPE.BATTLE, "");
		m_Bgm.AddList(Bgm.BGM_TYPE.SYS_WIN_LOOP, "bgm_btl_win", "bgm_btl_jingle");
		m_Bgm.AddList(Bgm.BGM_TYPE.SYS_LOSE_LOOP, "bgm_btl_lose", "bgm_btl_jingle");
		m_Bgm.AddList(Bgm.BGM_TYPE.HOME, "bgm_mpg_main");
		m_Bgm.AddList(Bgm.BGM_TYPE.TITLE, "bgm_ttl_main", PREINSTALL_CUESHEET);
		m_Bgm.AddList(Bgm.BGM_TYPE.TITLE_SPECIAL_1, "bgm_ttl_main_sp1", PREINSTALL_CUESHEET);
		m_Bgm.AddList(Bgm.BGM_TYPE.TITLE_SPECIAL_2, "bgm_ttl_main_sp2", PREINSTALL_CUESHEET);
		m_Bgm.AddList(Bgm.BGM_TYPE.COLOSSEUM_FINAL, "bgm_st_lastbattle");
		m_Bgm.AddList(Bgm.BGM_TYPE.GRANDPRIX_SPECIAL, "bgm_gp_special_01");
		m_Bgm.AddList(Bgm.BGM_TYPE.GRANDPRIX_SPECIAL_FINAL, "bgm_gp_special_02");
		m_Bgm.AddList(Bgm.BGM_TYPE.SEALED, "bgm_open6");
		m_Bgm.AddList(Bgm.BGM_TYPE.QUEST, "bgm_quest_main");
		m_Bgm.AddList(Bgm.BGM_TYPE.COMPETITION_LOBBY, "bgm_competition");
		m_Bgm.AddList(Bgm.BGM_TYPE.BINGO, "bgm_bng_main");
	}

	public void AllMute(bool isMute)
	{
		BgmMute(isMute);
		SeMute(isMute);
		VoiceMute(isMute);
		MovieMute(isMute);
	}

	public void SetRejectNewSound(bool isMute)
	{
		_rejectNewSound = isMute;
	}

	public bool IsRejectNewSound()
	{
		return _rejectNewSound;
	}

	public void SetSeVolume(float prm)
	{
		m_Se.SetVolume(prm);
	}

	public float GetSeVolume()
	{
		return m_Se.GetVolume();
	}

	public void SeMute(bool isMute)
	{
		m_Se.Mute(isMute);
	}

	public bool IsSeMuted()
	{
		return m_Se.IsMuted();
	}

	public void SetAisac(string cuename, string param, float num)
	{
		m_Se.SetAisac(cuename, param, num);
	}

	public void SetAisac(Se.TYPE setype, string param, float num)
	{
		m_Se.SetAisac(setype, param, num);
	}

	public void PlaySe(Se.TYPE setype, bool isSeSysSummonLandingDuplicateCheck = false)
	{
		m_Se.Play(setype, isSeSysSummonLandingDuplicateCheck);
	}

	public void PlaySeByStr(string sestring, string AcbName, float fadeInTime = 0f, long startTime = 0L)
	{
		m_Se.PlayByStr(sestring, AcbName, fadeInTime, startTime);
	}

	public void PlaySeByStr(string sestring, float fadeInTime = 0f, long startTime = 0L)
	{
		PlaySeByStr(sestring, sestring, fadeInTime, startTime);
	}

	public void PlayLoopSe(Se.TYPE setype)
	{
		m_Se.PlayLoop(setype);
	}

	public void PlayLoopSeByStr(string sestring, float fadeInTime = 0f, long startTime = 0L)
	{
		m_Se.PlayLoopByStr(sestring, fadeInTime, startTime);
	}

	public void ChangeAisac(float aisacnum)
	{
		m_Se.AisacChange(aisacnum);
	}

	public void StopSe(string cuename, float fadeOutTime = 0.5f)
	{
		m_Se.Stop(cuename, fadeOutTime);
	}

	public void StopSe(Se.TYPE setype, float fadetime = 0f)
	{
		m_Se.Stop(setype, fadetime);
	}

	public void StopSeAll(float fadeOutTime)
	{
		m_Se.StopAll(fadeOutTime);
	}

	public string LoadSe(string cueSheet, Action onLoaded = null)
	{
		return Load(LoadType.Se, cueSheet, onLoaded)[0];
	}

	public void UnloadSe(string cueSheet)
	{
		Unload(LoadType.Se, cueSheet);
	}

	public void UnloadSe(List<string> cueSheets)
	{
		for (int i = 0; i < cueSheets.Count; i++)
		{
			UnloadSe(cueSheets[i]);
		}
	}

	public void PlayToggleSe(bool isOn)
	{
		if (isOn)
		{
			PlaySe(Se.TYPE.SYS_TOGGLE_ON);
		}
		else
		{
			PlaySe(Se.TYPE.SYS_TOGGLE_OFF);
		}
	}

	public void SetVoiceVolume(float prm)
	{
		m_Voice.SetVolume(prm);
	}

	public float GetVoiceVolume()
	{
		return m_Voice.GetVolume();
	}

	public void VoiceMute(bool isMute)
	{
		m_Voice.Mute(isMute);
	}

	public bool IsVoiceMuted()
	{
		return m_Voice.IsMuted();
	}

	public void PlayVoice(ClassCharaPrm.EmotionType emotiontype, int classid, List<string> pathList, string voiceId = "", bool isEvolved = false)
	{
		m_Voice.Play(emotiontype, classid, pathList, voiceId, isEvolved);
	}

	public void PlayVoiceByKey(string quenameid, bool forcePlay = false)
	{
		m_Voice.PlayByKey(quenameid, forcePlay);
	}

	public void PlayVoiceScenario(string cuename, float fadeout = 0.5f)
	{
		m_Voice.PlayScenario(cuename, fadeout);
	}

	public float StopVoice(float fadeout = 0.5f)
	{
		m_Voice.StopVoice(fadeout);
		return fadeout;
	}

	public float StopVoiceAll(float fadeout = 0.5f)
	{
		m_Voice.StopAll(fadeout);
		return fadeout;
	}

	public bool IsVoicePlaying()
	{
		return m_Voice.IsPlaying();
	}

	public string LoadVoice(string cueSheet, Action onLoaded = null)
	{
		return Load(LoadType.Voice, cueSheet, onLoaded)[0];
	}

	public void UnloadVoice(string cueSheet)
	{
		Unload(LoadType.Voice, cueSheet);
	}

	public void UnloadVoice(List<string> cueSheets)
	{
		for (int i = 0; i < cueSheets.Count; i++)
		{
			UnloadVoice(cueSheets[i]);
		}
	}

	public string LoadTemporaryVoice(string cueSheet, Action onLoaded = null)
	{
		return Load(LoadType.TemporaryVoice, cueSheet, onLoaded)[0];
	}

	public void UnloadTemporaryVoice(string cueSheet)
	{
		Unload(LoadType.TemporaryVoice, cueSheet);
	}

	public void UnloadTemporaryVoice(List<string> cueSheets)
	{
		for (int i = 0; i < cueSheets.Count; i++)
		{
			UnloadTemporaryVoice(cueSheets[i]);
		}
	}

	public void SetBgmVolume(float prm)
	{
		m_Bgm.SetVolume(prm);
	}

	public float GetBgmVolume()
	{
		return m_Bgm.GetVolume();
	}

	public void BgmMute(bool isMute)
	{
		m_Bgm.Mute(isMute);
	}

	public bool IsBgmMuted()
	{
		return m_Bgm.IsMuted();
	}

	public void PlayBGM(Bgm.BGM_TYPE bgmtype, float fadetime = 0f)
	{
		if (bgmtype != Bgm.BGM_TYPE.BATTLE)
		{
			m_Bgm.Play(bgmtype, fadetime, 0L);
			CheckFocus();
		}
	}

	public void PlayCrossFadeBGM(Bgm.BGM_TYPE bgmtype, float fadeOutTime = 0.5f, float fadeInTime = 0f, long startTime = 0L)
	{
		if (bgmtype != Bgm.BGM_TYPE.BATTLE)
		{
			m_Bgm.PlayCrossFade(bgmtype, fadeOutTime, fadeInTime, startTime);
			CheckFocus();
		}
	}

	public void PlayBGM(string cuename, float fadeInTime = 0f, long startTime = 0L)
	{
		m_Bgm.Play(cuename, fadeInTime, startTime);
		CheckFocus();
	}

	public void PlayCrossFadeBGM(string cuename, float fadeOutTime = 0.5f, float fadeInTime = 0f, long startTime = 0L)
	{
		m_Bgm.PlayCrossFade(cuename, fadeOutTime, fadeInTime, startTime);
		CheckFocus();
	}

	public void PlayFadeOutBGM(Bgm.BGM_TYPE bgmtype, float fadeouttime = 0f, float fadeintime = 0f)
	{
		m_Bgm.PlayFadeOut(bgmtype, fadeouttime, fadeintime);
		CheckFocus();
	}

	public virtual void PauseBGM()
	{
		m_Bgm.Pause();
	}

	public virtual void StopBGM(Action OnStopped = null, float fadetime = 2f)
	{
		m_Bgm.Stop(fadetime, OnStopped);
	}

	public virtual void StopAllBGM(float fadetime = 2f)
	{
		m_Bgm.StopAll(fadetime);
	}

	public void FadeBgmVolume(float to, float time = 2f)
	{
		iTween.ValueTo(Toolbox.AudioManager.gameObject, iTween.Hash("from", GetBgmVolume(), "to", to, "time", time, "onupdate", "SetBgmVolume"));
	}

	public bool IsPlayBGM(Bgm.BGM_TYPE bgmType = Bgm.BGM_TYPE.NONE)
	{
		return m_Bgm.IsPlayBGM(bgmType);
	}

	public List<string> LoadBGM(Bgm.BGM_TYPE bgmType, Action onLoaded = null)
	{
		return LoadBGM(m_Bgm.GetCueSheet(bgmType), onLoaded);
	}

	public List<string> LoadBGM(string cueSheet, Action onLoaded = null)
	{
		if (string.IsNullOrEmpty(cueSheet) || m_Bgm.IsPreInstall(cueSheet, out var _))
		{
			onLoaded?.Invoke();
			return new List<string>();
		}
		return Load(LoadType.Bgm, cueSheet, onLoaded);
	}

	public void UnloadBGM(Bgm.BGM_TYPE bgmType)
	{
		UnloadBGM(m_Bgm.GetCueSheet(bgmType));
	}

	public void UnloadBGM(string cueSheet)
	{
		if (!m_Bgm.IsPreInstall(cueSheet, out var _))
		{
			Unload(LoadType.Bgm, cueSheet);
		}
	}

	public void UnloadBGM(List<string> cueSheets)
	{
		for (int i = 0; i < cueSheets.Count; i++)
		{
			UnloadBGM(cueSheets[i]);
		}
	}

	public void Stop_Play_BGM(Bgm.BGM_TYPE bgmType, Action onPlay = null, float fadeoutTime = 2f)
	{
		if (IsPlayBGM(bgmType))
		{
			if (onPlay != null)
			{
				Toolbox.AudioManager.StartCoroutine_DelayMethod(1f, onPlay);
			}
			return;
		}
		StopBGM(delegate
		{
			PlayBGM(bgmType);
			if (onPlay != null)
			{
				onPlay();
			}
		}, fadeoutTime);
	}

	public void PlayEnvSound(string sestring, float fadeInTime = 0f, long startTime = 0L)
	{
		Toolbox.AudioManager.AddCueSheet(sestring, sestring + ".acb", "s/", sestring + ".awb");
		PlaySeByStr(sestring, sestring, fadeInTime, startTime);
	}

	public void StopEnvSound(string cuename, float fadeoutTime, bool isImmediatelyRemove = false)
	{
		StopSe(cuename, fadeoutTime);
		if (isImmediatelyRemove)
		{
			Toolbox.AudioManager.RemoveCueSheet(cuename);
			return;
		}
		Toolbox.AudioManager.StartCoroutine_DelayMethod(fadeoutTime, delegate
		{
			Toolbox.AudioManager.RemoveCueSheet(cuename);
		});
	}

	public List<string> LoadEnvSound(string cueSheet, Action onLoaded = null)
	{
		return Load(LoadType.EnvSound, cueSheet, onLoaded);
	}

	public void SetMovieVolume(float volume)
	{
		if (!IsMovieMuted())
		{
			Toolbox.MovieManager.SetVolume(volume);
		}
		m_movieVolume = volume;
	}

	public float GetMovieVolume()
	{
		return m_movieVolume;
	}

	public void MovieMute(bool isMute)
	{
		Toolbox.MovieManager.SetVolume((!isMute) ? m_movieVolume : 0f);
		m_isMovieMute = isMute;
	}

	public bool IsMovieMuted()
	{
		return m_isMovieMute;
	}

	private List<string> Load(LoadType loadType, string cueSheet, Action onLoaded)
	{
		if (cueSheet == PREINSTALL_CUESHEET)
		{
			if (onLoaded != null)
			{
				onLoaded();
			}
			return null;
		}
		List<string> loadTargetFiles = GetLoadTargetFiles(loadType, cueSheet);
		Toolbox.ResourcesManager.StartCoroutine_LoadAssetGroupSync(loadTargetFiles, delegate
		{
			if (onLoaded != null)
			{
				onLoaded();
			}
		});
		return loadTargetFiles;
	}

	private void Unload(LoadType loadType, string cueSheet)
	{
		if (!(cueSheet == PREINSTALL_CUESHEET))
		{
			Toolbox.ResourcesManager.RemoveAssetGroup(GetLoadTargetFiles(loadType, cueSheet));
		}
	}

	private List<string> GetLoadTargetFiles(LoadType loadType, string cueSheet)
	{
		List<string> list = new List<string>();
		switch (loadType)
		{
		case LoadType.Se:
			list.Add("s/" + cueSheet + ".acb");
			break;
		case LoadType.Bgm:
			list.Add("b/" + cueSheet + ".acb");
			list.Add("b/" + cueSheet + ".awb");
			break;
		case LoadType.Voice:
			list.Add(GetVoiceLoadPath(cueSheet));
			break;
		case LoadType.TemporaryVoice:
			list.Add("v/t/" + cueSheet + ".acb");
			break;
		case LoadType.EnvSound:
			list.Add("s/" + cueSheet + ".acb");
			list.Add("s/" + cueSheet + ".awb");
			break;
		}
		return list;
	}

	public string GetVoiceLoadPath(string cueSheet)
	{
		return "v/" + cueSheet + ".acb";
	}

	public void SetUseDownloadVoice(bool isUse)
	{
		Toolbox.AudioManager.isDownloadVoiceUse = isUse;
	}

	public void OnFocus(bool focus)
	{
		SetBgmOnOff(focus);
	}

	private void SetBgmOnOff(bool b)
	{
		if (!PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.PLAY_SOUND_IN_BACKGROUND))
		{
			Toolbox.AudioManager.PauseAllBgm(!b);
			if (b)
			{
				AllMute(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SOUND_MUTE));
			}
			else
			{
				AllMute(isMute: true);
			}
		}
	}

	private void CheckFocus()
	{
		if (!UIManager.GetInstance().ApplicationHasFocus)
		{
			SetBgmOnOff(b: false);
		}
	}
}
