/// <summary> /// Called whenever a new scene is loaded /// </summary> /// <param name="scene">scene loaded</param> /// <param name="mode">mode that scene was loaded under</param> void OnSceneLoaded(Scene scene, LoadSceneMode mode) { // if music playing doesn't match track for scene, switch tracks SongNames trackForScene = MusicManager.GetSongFromScene(scene.name); if (myAudioSource.clip == null || myAudioSource.clip.name != trackForScene.ToString()) { MusicManager.SwitchTrack(trackForScene); } }
public bool Add(SongNames song) { if (string.IsNullOrWhiteSpace(song.Hash) || string.IsNullOrWhiteSpace(song.Title)) { Logger.IPALogger.Notice($"Invalid Infos: {song.Hash} {song.MapKey} {song.Title}"); return(false); } Store[song.Hash] = song; return(true); }
/// <summary> /// Swaps background music to different track /// </summary> /// <param name="newTrack">name of new track to play</param> public static void SwitchTrack(SongNames newTrack) { // stop source, switch track, and restart source myAudioSource.Stop(); myAudioSource.clip = tracks[newTrack]; myAudioSource.Play(); // if closed captions are enabled, display appropriate caption for track if (ClosedCaptions.Instance.ccEnabled) { ClosedCaptions.Instance.DisplayCaptions(tracksToCaptions[newTrack]); } }
public static string ToFormattedTitle(SongNames infos, DisplayFormat type) { switch (type) { case DisplayFormat.Title_Author_Product_Mapper: case DisplayFormat.Title_Product_Author_Mapper: case DisplayFormat.Title_Subtitle_Author_Mapper: case DisplayFormat.Title_Subtitle_Author_Product: case DisplayFormat.Title_Subtitle_Product_Mapper: default: return(infos.Title ?? ""); } ; }
/// <summary> /// Loads all data. Should be positioned on the start /// if the second data hunk. /// </summary> /// <param name="dataReader"></param> public ExecutableData(IDataReader dataReader) { // TODO: For now we search the offset of the filelist manually // until we decode all of the data. dataReader.Position = (int)dataReader.FindString("0Map_data.amb", 0) - 184; // TODO ... FileList = new FileList(dataReader); WorldNames = new WorldNames(dataReader); Messages = new Messages(dataReader); if (dataReader.ReadDword() != 0) { throw new AmbermoonException(ExceptionScope.Data, "Invalid executable data."); } AutomapNames = new AutomapNames(dataReader); OptionNames = new OptionNames(dataReader); SongNames = new SongNames(dataReader); SpellTypeNames = new SpellTypeNames(dataReader); SpellNames = new SpellNames(dataReader); LanguageNames = new LanguageNames(dataReader); ClassNames = new ClassNames(dataReader); RaceNames = new RaceNames(dataReader); AbilityNames = new AbilityNames(dataReader); AttributeNames = new AttributeNames(dataReader); AbilityNames.AddShortNames(dataReader); AttributeNames.AddShortNames(dataReader); ItemTypeNames = new ItemTypeNames(dataReader); AilmentNames = new AilmentNames(dataReader); UITexts = new UITexts(dataReader); // TODO: There is a bunch of binary data (gfx maybe?) // TODO: Then finally the item data comes ... // TODO ... }
public void setMusic(SongNames sn) { AudioClip toPlay = null; switch (currSong) { case SongNames.menu: menuClipTime = source.time - .5f; break; case SongNames.battle: battleClipTime = source.time - .5f; break; case SongNames.boss: bossClipTime = source.time - .5f; break; case SongNames.shop: shopClipTime = source.time - .5f; break; case SongNames.victory: victoryClipTime = source.time - .5f; break; case SongNames.death: deathClipTime = source.time - .5f; break; } switch (sn) { case SongNames.menu: toPlay = menuClip; break; case SongNames.battle: toPlay = battleClip; break; case SongNames.boss: toPlay = bossClip; break; case SongNames.shop: toPlay = shopClip; break; case SongNames.victory: toPlay = victoryClip; break; case SongNames.death: toPlay = deathClip; break; } currSong = sn; source.clip = toPlay; source.Play(); try { switch (sn) { case SongNames.menu: source.time = menuClipTime; break; case SongNames.battle: source.time = battleClipTime; break; case SongNames.boss: source.time = bossClipTime; break; case SongNames.shop: source.time = shopClipTime; break; case SongNames.victory: source.time = victoryClipTime; break; case SongNames.death: source.time = deathClipTime; break; } } catch { switch (sn) { case SongNames.menu: menuClipTime = 0; break; case SongNames.battle: battleClipTime = 0; break; case SongNames.boss: bossClipTime = 0; break; case SongNames.shop: shopClipTime = 0; break; case SongNames.victory: victoryClipTime = 0; break; case SongNames.death: deathClipTime = 0; break; } source.time = 0; } }
public static void ModifiyMapper(FieldInfo field, object level, SongNames info, DisplayFormat type) { field.SetValue(level, ToFormattedMapper(info, type)); }