예제 #1
0
    void LoadSkillAbilities(SkillsData skillData)
    {
        // Read all entries from the table
        string query = "SELECT * FROM " + "skill_ability_gain" + " where skillID = " + skillData.id;

        // If there is a row, clear it.
        if (rows != null)
            rows.Clear ();

        // Load data
        rows = DatabasePack.LoadData (DatabasePack.contentDatabasePrefix, query);
        //Debug.Log("#Rows:"+rows.Count);
        // Read all the data
        if ((rows != null) && (rows.Count > 0)) {
            foreach (Dictionary<string,string> data in rows) {
                SkillAbilityEntry entry = new SkillAbilityEntry ();

                entry.id = int.Parse (data ["id"]);
                entry.skillLevelReq = int.Parse (data ["skillLevelReq"]);
                entry.abilityID = int.Parse (data ["abilityID"]);
                entry.automaticallyLearn = bool.Parse (data ["automaticallyLearn"]);
                skillData.skillAbilities.Add (entry);
            }
        }
    }
예제 #2
0
    void UpdateAbility(SkillAbilityEntry entry)
    {
        string query = "UPDATE skill_ability_gain";
        query += " SET ";
        query += entry.UpdateList ();
        query += " WHERE id=?id";

        // Setup the register data
        List<Register> update = new List<Register> ();
        foreach (string field in entry.fields.Keys) {
            update.Add (entry.fieldToRegister (field));
        }

        DatabasePack.Update (DatabasePack.contentDatabasePrefix, query, update);
    }
예제 #3
0
    void InsertAbility(SkillAbilityEntry entry)
    {
        string query = "INSERT INTO skill_ability_gain";
        query += " (skillID, skillLevelReq, abilityID, automaticallyLearn) ";
        query += "VALUES ";
        query += " (" + entry.skillID + "," + entry.skillLevelReq + "," + entry.abilityID + "," + entry.automaticallyLearn + ") ";

        // Setup the register data
        List<Register> update = new List<Register> ();
        foreach (string field in entry.fields.Keys) {
            update.Add (entry.fieldToRegister (field));
        }

        int itemID = -1;
        itemID = DatabasePack.Insert (DatabasePack.contentDatabasePrefix, query, update);

        entry.id = itemID;
    }