1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using System;
- using System.Collections.Generic;
- public class PhotoSoundData
- {
- private PhotoSoundData()
- {
- }
- public static void Create()
- {
- if (PhotoSoundData.sound_data_ != null)
- {
- return;
- }
- PhotoSoundData.sound_data_ = new List<PhotoSoundData>();
- using (AFileBase afileBase = GameUty.FileSystem.FileOpen("phot_sound_list.nei"))
- {
- using (CsvParser csvParser = new CsvParser())
- {
- bool condition = csvParser.Open(afileBase);
- NDebug.Assert(condition, "phot_sound_list.nei\nopen failed.");
- for (int i = 1; i < csvParser.max_cell_y; i++)
- {
- if (csvParser.IsCellToExistData(0, i))
- {
- int num = 0;
- PhotoSoundData photoSoundData = new PhotoSoundData();
- photoSoundData.id = (long)csvParser.GetCellAsInteger(num++, i);
- photoSoundData.name = csvParser.GetCellAsString(num++, i);
- photoSoundData.file_name = csvParser.GetCellAsString(num++, i);
- if (GameUty.FileSystem.IsExistentFile(photoSoundData.file_name))
- {
- PhotoSoundData.sound_data_.Add(photoSoundData);
- }
- }
- }
- }
- }
- }
- public static List<PhotoSoundData> data
- {
- get
- {
- return PhotoSoundData.sound_data_;
- }
- }
- public static PhotoSoundData Get(long id)
- {
- for (int i = 0; i < PhotoSoundData.sound_data_.Count; i++)
- {
- if (PhotoSoundData.sound_data_[i].id == id)
- {
- return PhotoSoundData.sound_data_[i];
- }
- }
- return null;
- }
- public static PhotoSoundData Get(string file_name)
- {
- for (int i = 0; i < PhotoSoundData.sound_data_.Count; i++)
- {
- if (PhotoSoundData.sound_data_[i].file_name == file_name)
- {
- return PhotoSoundData.sound_data_[i];
- }
- }
- return null;
- }
- public void Play()
- {
- GameMain.Instance.SoundMgr.PlayBGM(this.file_name, 0f, true);
- }
- public long id;
- public string name;
- public string file_name;
- private static List<PhotoSoundData> sound_data_;
- }
|