public static bool RestoreBGMPlayTime(string goName) { TsAudioBGM._PlayTimeInfo playTimeInfo = null; foreach (TsAudioBGM._PlayTimeInfo current in TsAudioBGM.s_playTimeInfos) { if (current.goName.Equals(goName)) { playTimeInfo = current; } } if (playTimeInfo == null) { return(false); } GameObject gameObject = GameObject.Find(goName); if (gameObject == null) { return(false); } gameObject.audio.time = playTimeInfo.playTime; playTimeInfo.playTime = 0f; return(true); }
public static void SaveCurrentBGMPlayTime() { if (TsAudioBGM.s_currentBGM == null || TsAudioBGM.s_currentBGM.RefAudioSource == null) { return; } if (TsAudioBGM.s_playTimeInfos.Count >= 5) { TsAudioBGM.s_playTimeInfos.RemoveAt(0); } TsAudioBGM._PlayTimeInfo item = null; foreach (TsAudioBGM._PlayTimeInfo current in TsAudioBGM.s_playTimeInfos) { if (TsAudioBGM.s_currentBGM.RefAudioSource.name.Equals(current.goName)) { item = current; } } TsAudioBGM.s_playTimeInfos.Remove(item); TsAudioBGM._PlayTimeInfo playTimeInfo = new TsAudioBGM._PlayTimeInfo(); playTimeInfo.goName = TsAudioBGM.s_currentBGM.RefAudioSource.name; playTimeInfo.playTime = TsAudioBGM.s_currentBGM.RefAudioSource.time; TsAudioBGM.s_playTimeInfos.Add(playTimeInfo); }