public void selectAll() { if (allUpgradeRules == null || allUpgradeRules.Count == 0) { string query = "SELECT * FROM " + UPGRADE_TABLE_NAME + ""; SQLiteDataReader mReader = sqlManager.executeReader(query); List <UpgradeRule> ruleList = new List <UpgradeRule>(); if (mReader.Read()) { do { int id = mReader.GetInt32(0); int level = mReader.GetInt32(1); int groundAttackPlus = mReader.GetInt32(2); int airAttackPlus = mReader.GetInt32(3); int healthPlus = mReader.GetInt32(4); int price = mReader.GetInt32(5); int minUserLevel = mReader.GetInt32(6); UpgradeRule unit = new UpgradeRule(id, level, groundAttackPlus, airAttackPlus, healthPlus, price, minUserLevel); ruleList.Add(unit); } while (mReader.NextResult()); } allUpgradeRules = ruleList; } }
public void selectAll() { if (allUnitFeatuers == null || allUnitFeatuers.Count == 0) { ruleManager.selectAll(); string query = "SELECT * FROM " + UNIT_TABLE_NAME + ""; SQLiteDataReader mReader = sqlManager.executeReader(query); List <UnitFeatures> unitList = new List <UnitFeatures>(); int Counter = 0; if (mReader.Read()) { do { Counter++; int id = mReader.GetInt32(0); string name = mReader.GetString(1); int powerSpawn = mReader.GetInt32(2); int powerMove = mReader.GetInt32(3); int powerAttack = mReader.GetInt32(4); float powerRegen = mReader.GetFloat(5); int airDamage = mReader.GetInt32(6); int groundDamage = mReader.GetInt32(7); float armorPricsingDamagePoint = mReader.GetFloat(8); float splashDamagePoint = mReader.GetFloat(9); int health = mReader.GetInt32(10); bool isArmored = mReader.GetBoolean(11); bool isGrounded = mReader.GetBoolean(12); int width = (int)mReader.GetFloat(15); int height = (int)mReader.GetFloat(16); int vision = mReader.GetInt32(17); int requiredLevel = mReader.GetInt32(18); int coinCost = mReader.GetInt32(19); int lastModified = mReader.GetInt32(21); int moveSpeed = mReader.GetInt32(22); string description = mReader.GetString(23); bool isVehicle = mReader.GetBoolean(24); int shotPerTurn = mReader.GetInt32(25); bool isInDeck; bool isLocked; int currentLevel; isInDeck = false; //mReader.GetBoolean(14); isLocked = false; //mReader.GetBoolean(13); currentLevel = 1; //mReader.GetInt32(20); UnitFeatures unit = new UnitFeatures(id, name, powerSpawn, powerMove, powerAttack, powerRegen, airDamage, groundDamage, armorPricsingDamagePoint, splashDamagePoint, health, isArmored, isGrounded, isLocked, isInDeck, width, height, vision, requiredLevel, coinCost, currentLevel, lastModified, moveSpeed, description, isVehicle, shotPerTurn);//,numberOfStateImages,numberOfDirections); List <UpgradeRule> upgradeRule = ruleManager.selectUnitUpgradeRule(id); unit.rules = upgradeRule; unitList.Add(unit); } while (mReader.Read()); } allUnitFeatuers = unitList; } }