public void Startup() { SetupUnits(); unitChars = new Dictionary <int, TowerChar>(); using (IDataReader dr = Managers.Database.GetSQLiteQuery("SELECT * FROM TowerChars")) { while (dr.Read()) { int char_id = Convert.ToInt32(dr["ID"]); unitChars[char_id] = new TowerChar(dr["name"].ToString(), dr["image"].ToString()); } UnitLevels = new Dictionary <int, Dictionary <int, Dictionary <int, double> > >(); dr.Close(); } using (IDataReader dr = Managers.Database.GetSQLiteQuery("SELECT u.item_id, ul.level, ulc.unitcharid AS char_id, ulc.value FROM Units AS u JOIN UnitLevels AS ul ON ul.unit_id = u.ID JOIN UnitLevelChars AS ulc ON ulc.unitlevelid = ul.ID;")) { while (dr.Read()) { int item_id = Convert.ToInt32(dr["item_id"]); int level = Convert.ToInt32(dr["level"]); int char_id = Convert.ToInt32(dr["char_id"]); double value = Convert.ToDouble(dr["value"]); if (!UnitLevels.ContainsKey(item_id)) { UnitLevels[item_id] = new Dictionary <int, Dictionary <int, double> >(); } if (!UnitLevels[item_id].ContainsKey(level)) { UnitLevels[item_id][level] = new Dictionary <int, double>(); } UnitLevels[item_id][level][char_id] = value; } dr.Close(); } LoadSession(); status = ManagerStatus.Started; }
public void SetData(TowerChar chr, double value) { text.text = String.Format("{0}: {1}", chr.Name, value); image.material = chr.Material; }