/// <summary> /// Raises the load event. /// </summary> /// <param name='info'> /// Info. /// </param> public override void OnLoad(ViNoSaveData info) { if (currentAudioKey == info.m_BgmName) { ViNoDebugger.Log("Sound", "currentAudioKey:" + currentAudioKey + "info.BGM:" + info.m_BgmName); return; } ViNoDebugger.Log("Sound", "<color=cyan>" + "OnLoad in ViNoSoundPlayer" + "</color>"); StopMusic(1f); ViNoDebugger.Log("Sound", info.m_BgmName + " Play. "); if (!string.IsNullOrEmpty(info.m_BgmName) || !info.m_BgmName.Equals("NotPlayed")) { // StartCoroutine( "DelayPlayBGM" , info.m_BgmName ); bool loop = true; PlayMusic(info.m_BgmName, loop, 0f); // player.PlayMusic( item , true , 0f ); } else { ViNoDebugger.Log("Sound", "No Music was Played when Saved."); StopMusic(kPlayDelayWhenLoaded); } }
/// <summary> /// Raises the save event. /// </summary> /// <param name='info'> /// Info. /// </param> public override void OnSave( ViNoSaveData info ){ if( currentAudio != null ){ if( currentAudio.isPlaying ){ ViNoDebugger.Log( "Sound" , currentAudioKey + " is Playing when Save. Now , Save the Music Name." ); info.m_BgmName = currentAudioKey; } else{ info.m_BgmName = "NotPlayed"; } } else{ info.m_BgmName = "NotPlayed"; } }
/// <summary> /// Raises the save event. /// </summary> /// <param name='info'> /// Info. /// </param> public override void OnSave(ViNoSaveData info) { if (currentAudio != null) { if (currentAudio.isPlaying) { ViNoDebugger.Log("Sound", currentAudioKey + " is Playing when Save. Now , Save the Music Name."); info.m_BgmName = currentAudioKey; } else { info.m_BgmName = "NotPlayed"; } } else { info.m_BgmName = "NotPlayed"; } }
static public void LoadDataFromStorage(string fileName, ref ViNoSaveInfo reloadedInfo) { // Debug.Log( "FileName:" + fileName); #if UNITY_WEBPLAYER string xmlStr = PlayerPrefs.GetString(fileName + ".xml"); //ViNoGameSaveLoad.LoadXML( fileName + ".xml" ); #else string xmlStr = ViNoGameSaveLoad.LoadXML(fileName + ".xml"); #endif ViNoSaveData saveData = ViNoGameSaveLoad.DeserializeObject <ViNoSaveData>(xmlStr) as ViNoSaveData; reloadedInfo.data.m_BgmName = saveData.m_BgmName; reloadedInfo.data.m_CurrentScenarioName = saveData.m_CurrentScenarioName; reloadedInfo.data.m_LoadedLevelIndex = saveData.m_LoadedLevelIndex; reloadedInfo.data.m_LoadedLevelName = saveData.m_LoadedLevelName; reloadedInfo.data.m_NodeName = saveData.m_NodeName; reloadedInfo.data.m_SceneXmlData = saveData.m_SceneXmlData; reloadedInfo.data.m_ScenarioResourceFilePath = saveData.m_ScenarioResourceFilePath; reloadedInfo.data.m_Date = saveData.m_Date; reloadedInfo.data.m_ScenarioDescription = saveData.m_ScenarioDescription; }
/// <summary> /// Raises the load event. /// </summary> /// <param name='info'> /// Info. /// </param> public override void OnLoad( ViNoSaveData info ){ if( currentAudioKey == info.m_BgmName ){ ViNoDebugger.Log( "Sound" , "currentAudioKey:"+ currentAudioKey + "info.BGM:" + info.m_BgmName); return; } ViNoDebugger.Log( "Sound" , "<color=cyan>" + "OnLoad in ViNoSoundPlayer" + "</color>"); StopMusic( 1f ); ViNoDebugger.Log( "Sound" , info.m_BgmName + " Play. " ); if( ! string.IsNullOrEmpty( info.m_BgmName ) || ! info.m_BgmName.Equals( "NotPlayed" ) ){ // StartCoroutine( "DelayPlayBGM" , info.m_BgmName ); bool loop = true; PlayMusic( info.m_BgmName , loop , 0f ); // player.PlayMusic( item , true , 0f ); } else{ ViNoDebugger.Log ( "Sound" , "No Music was Played when Saved." ); StopMusic( kPlayDelayWhenLoaded ); } }