public static int GetRandomAudioClip(int type, float colorR) { SESoundStory story = s_tblSeSoundInfo.Find(ret => (ret.type == type && Mathf.Abs(ret.colorR - colorR * 255) < 2.0f)); if (story == null) { return(-1); } else { return(story.GetRandomAudioClip()); } }
public static void LoadData() { s_tblSeSoundInfo = new List <SESoundStory>(); SqliteDataReader reader = LocalDatabase.Instance.ReadFullTable("soundspawn"); while (reader.Read()) { SESoundStory se = new SESoundStory(); se.type = Convert.ToInt32(reader.GetString(reader.GetOrdinal("type"))); se.colorR = Convert.ToInt32(reader.GetString(reader.GetOrdinal("num"))); se.soundInfoStr = reader.GetString(reader.GetOrdinal("soundInfo")); se.StringToSounds(); s_tblSeSoundInfo.Add(se); } }