// LOGIC public void Initialize(string i_DatabasePath) { tnStadiumsDatabase database = Resources.Load <tnStadiumsDatabase>(i_DatabasePath); if (database != null) { for (int index = 0; index < database.stadiumsCount; ++index) { tnStadiumDataEntry entry = database.GetStadiumDataEntry(index); if (entry != null) { string key = entry.id; tnStadiumDataDescriptor descriptor = entry.descriptor; if (key != "" && descriptor != null) { int hash = StringUtils.GetHashCode(key); tnStadiumData data = new tnStadiumData(descriptor); m_Data.Add(hash, data); m_Keys.Add(hash); } } } } else { LogManager.LogWarning(this, "Database not loaded."); } }
// UTILS private int GetMinPlayers(string i_StadiumId) { tnStadiumsDatabase stadiumDatabase = Resources.Load <tnStadiumsDatabase>("Database/Game/StadiumsDatabase"); if (stadiumDatabase == null) { return(0); } for (int index = 0; index < stadiumDatabase.stadiumsCount; ++index) { tnStadiumDataEntry entry = stadiumDatabase.GetStadiumDataEntry(index); if (entry.id == i_StadiumId) { tnStadiumDataDescriptor stadiumDataDescriptor = entry.descriptor; if (stadiumDataDescriptor != null) { return(stadiumDataDescriptor.minTeamSize); } } } return(0); }