Пример #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (UserId != 0)
            {
                hash ^= UserId.GetHashCode();
            }
            if (ActivityId != 0)
            {
                hash ^= ActivityId.GetHashCode();
            }
            if (MusicId != 0)
            {
                hash ^= MusicId.GetHashCode();
            }
            if (DiffType != 0)
            {
                hash ^= DiffType.GetHashCode();
            }
            if (MaxScore != 0)
            {
                hash ^= MaxScore.GetHashCode();
            }
            return(hash);
        }
Пример #2
0
        public static String Get(MusicId id)
        {
            if (_dic.TryGetValue(id, out var name))
            {
                return(name);
            }

            return($"Unknown music: {id}");
        }
Пример #3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ActivityId != 0)
            {
                hash ^= ActivityId.GetHashCode();
            }
            if (MusicId != 0)
            {
                hash ^= MusicId.GetHashCode();
            }
            if (MusicName.Length != 0)
            {
                hash ^= MusicName.GetHashCode();
            }
            return(hash);
        }
Пример #4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (SceneId != 0)
            {
                hash ^= SceneId.GetHashCode();
            }
            if (TalkId != 0)
            {
                hash ^= TalkId.GetHashCode();
            }
            if (BgId != 0)
            {
                hash ^= BgId.GetHashCode();
            }
            if (MusicId.Length != 0)
            {
                hash ^= MusicId.GetHashCode();
            }
            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (Content.Length != 0)
            {
                hash ^= Content.GetHashCode();
            }
            hash ^= selectIds_.GetHashCode();
            hash ^= selectContents_.GetHashCode();
            if (MusicLen != 0F)
            {
                hash ^= MusicLen.GetHashCode();
            }
            if (SceneName.Length != 0)
            {
                hash ^= SceneName.GetHashCode();
            }
            return(hash);
        }
Пример #5
0
        public static void Init()
        {
            Memory.Log.WriteLine($"{nameof(Music)} :: {nameof(Init)}");
            // PC 2000 version has an CD audio track for eyes on me. I don't think we can play that.
            const MusicId unkPrefix         = (MusicId)999;
            const MusicId altLoserPrefix    = (MusicId)512;
            const MusicId loserPrefix       = (MusicId)0;
            const MusicId eyesOnMePrefix    = (MusicId)513;
            const MusicId altEyesOnMePrefix = (MusicId)22;

            string[] ext = { ".ogg", ".sgt", ".wav", ".mp3" };
            //Roses and Wine V07 moves most of the sgt files to dmusic_backup
            //it leaves a few files behind. I think because RaW doesn't replace everything.
            //ogg files stored in:
            string RaW_ogg_pt = Extended.GetUnixFullPath(Path.Combine(Memory.FF8DIR, "RaW", "GLOBAL", "Music"));
            // From what I gather the OGG files and the sgt files have the same numerical prefix. I
            // might try to add the functionality to the debug screen monday.

            string dmusic_pt    = Extended.GetUnixFullPath(Path.Combine(Memory.FF8DIRdata, "Music", "dmusic_backup"));
            string music_pt     = Extended.GetUnixFullPath(Path.Combine(Memory.FF8DIRdata, "Music", "dmusic"));
            string music_wav_pt = Extended.GetUnixFullPath(Path.Combine(Memory.FF8DIRdata, "Music"));

            // goal of dicmusic is to be able to select a track by prefix. it adds an list of files
            // with the same prefix. so you can later on switch out which one you want.
            AddMusicPath(RaW_ogg_pt);
            AddMusicPath(music_wav_pt);
            AddMusicPath(dmusic_pt);
            AddMusicPath(music_pt);
            if (!Memory.dicMusic.ContainsKey(eyesOnMePrefix) && Memory.dicMusic.ContainsKey(altEyesOnMePrefix))
            {
                Memory.dicMusic.Add(eyesOnMePrefix, Memory.dicMusic[altEyesOnMePrefix]);
            }
            ArchiveBase a = ArchiveZzz.Load(Memory.Archives.ZZZ_OTHER);

            string[] list = a?.GetListOfFiles();
            if (list != null && list.Length > 0)
            {
                ZZZ = true;
                foreach (string m in list.Where(x => ext.Any(y => x.EndsWith(y, StringComparison.OrdinalIgnoreCase))))
                {
                    AddMusic(m);
                }
            }
            void AddMusicPath(string p)
            {
                if (!string.IsNullOrWhiteSpace(p) && Directory.Exists(p))
                {
                    foreach (string m in Directory.GetFiles(p).Where(x => ext.Any(y => x.EndsWith(y, StringComparison.OrdinalIgnoreCase))))
                    {
                        AddMusic(m);
                    }
                }
            }

            void AddMusic(string m)
            {
                if (ushort.TryParse(Path.GetFileName(m).Substring(0, 3), out ushort key))
                {
                    //mismatched prefix's go here
                    if ((MusicId)key == altLoserPrefix)
                    {
                        key = (ushort)loserPrefix; //loser.ogg and sgt don't match.
                    }
                }
                else if (m.IndexOf("eyes_on_me", StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    key = (ushort)eyesOnMePrefix;
                }
                else
                {
                    key = (ushort)unkPrefix;
                }

                if (!Memory.dicMusic.ContainsKey((MusicId)key))
                {
                    Memory.dicMusic.Add((MusicId)key, new List <string> {
                        m
                    });
                }
                else
                {
                    Memory.dicMusic[(MusicId)key].Add(m);
                }
            }
        }
Пример #6
0
 public SETBATTLEMUSIC(MusicId musicId)
 {
     _musicId = musicId;
 }
Пример #7
0
 public void ChangeBattleMusic(MusicId musicId)
 {
     // TODO: Field script
     Console.WriteLine($"NotImplemented: {nameof(MusicService)}.{nameof(ChangeBattleMusic)}({nameof(musicId)}: {musicId})");
 }
Пример #8
0
    public static void PlayMusic(this SoundManager sound, MusicId musicId)
    {
        string path = Utility.Text.Format("Assets/Game/Res/Sounds/Music/{0}.mp3", musicId.ToString());

        GameEntry.Sound.PlaySound(path, false);
    }
Пример #9
0
 public SetBattleMusic(MusicId musicId) => _musicId = musicId;
Пример #10
0
 public void LoadFieldMusic(MusicId musicId) =>
 // TODO: Field script
 Console.WriteLine($"NotImplemented: {nameof(MusicService)}.{nameof(LoadFieldMusic)}({nameof(musicId)}: {musicId})");
Пример #11
0
 public void LoadFieldMusic(MusicId musicId) => throw new NotSupportedException();
Пример #12
0
 public void ChangeBattleMusic(MusicId musicId) => throw new NotSupportedException();
Пример #13
0
 public override string ToString()
 {
     return($"RGB Color: {RgbValue:X}\n" + $"Brightness: {Illumination.ToString()}\n" +
            $"Protocol version: {ProtoVersion}\n" + $"Current music ID: {MusicId.ToString()}\n" +
            $"Able to join: {JoinPermission}\n");
 }