Beispiel #1
0
        public void CreateTables(SimpleSQLManager dbManager)
        {
            SimpleDataTable      dtConfigRow             = dbManager.QueryGeneric("SELECT COUNT(*) CT FROM sqlite_master where type='table' and name='ConfigRow'");
            List <SimpleDataRow> simpleDataConfigRowRows = dtConfigRow.rows;

            if (int.Parse(simpleDataConfigRowRows[0]["CT"].ToString()) == 0)
            {
                dbManager.CreateTable <ConfigRow>();
                Debug.Log("create table ConfigRow.");
            }
            SimpleDataTable      dtResourceRow             = dbManager.QueryGeneric("SELECT COUNT(*) CT FROM sqlite_master where type='table' and name='ResourceRow'");
            List <SimpleDataRow> simpleDataResourceRowRows = dtResourceRow.rows;

            if (int.Parse(simpleDataResourceRowRows[0]["CT"].ToString()) == 0)
            {
                dbManager.CreateTable <ResourceRow>();
                Debug.Log("create table ResourceRow.");
            }
            SimpleDataTable      dtSessionRow             = dbManager.QueryGeneric("SELECT COUNT(*) CT FROM sqlite_master where type='table' and name='SessionRow'");
            List <SimpleDataRow> simpleDataSessionRowRows = dtSessionRow.rows;

            if (int.Parse(simpleDataSessionRowRows[0]["CT"].ToString()) == 0)
            {
                dbManager.CreateTable <SessionRow>();
                Debug.Log("create table SessionRow.");
            }
        }
Beispiel #2
0
        public string GetDescByCode(SimpleSQLManager dbManager, string code, string lan)
        {
            SimpleDataTable      dt             = dbManager.QueryGeneric(string.Format("SELECT Desc FROM ResourceRow WHERE Code = '{0}' AND Lan = '{1}'", code, lan));
            List <SimpleDataRow> simpleDataRows = dt.rows;

            if (dt == null || simpleDataRows == null || simpleDataRows.Count == 0)
            {
                return("-");
            }
            return(simpleDataRows[0]["Desc"].ToString());
        }
Beispiel #3
0
        public string LoadToken(SimpleSQLManager dbManager)
        {
            SimpleDataTable      dt             = dbManager.QueryGeneric("SELECT Token FROM SessionRow WHERE Id = 1");
            List <SimpleDataRow> simpleDataRows = dt.rows;

            if (dt == null || simpleDataRows == null || simpleDataRows.Count == 0)
            {
                return("-");
            }
            return(simpleDataRows[0]["Token"].ToString());
        }
Beispiel #4
0
        public string LoadLan(SimpleSQLManager dbManager)
        {
            SimpleDataTable      dt             = dbManager.QueryGeneric("SELECT Lan FROM ConfigRow WHERE Id = 1");
            List <SimpleDataRow> simpleDataRows = dt.rows;

            if (dt == null || simpleDataRows == null || simpleDataRows.Count == 0)
            {
                SaveDefaultConfig(dbManager);
                return("Chinese");
            }
            return(simpleDataRows[0]["Lan"].ToString());
        }
Beispiel #5
0
 public WeaponItem GetWeaponItem(string id)
 {
     try
     {
         if (string.IsNullOrEmpty(id))
         {
             return(null);
         }
         string ID = "'" + id + "'";
         SimpleSQL.SimpleDataTable dt =
             dbManager.QueryGeneric(
                 "SELECT " + "*" +
                 "FROM " +
                 "WeaponItem " +
                 "WHERE " + "ID LIKE " + ID);
         //Debug.Log("\"" + id + "\"" + dt.rows.Count);
         SuitEffectInfo setEffectInfo;
         if (dt.rows[0]["Suit"] != null)
         {
             setEffectInfo = GetSuitEffectInfo(dt.rows[0]["Suit"].ToString());
         }
         else
         {
             setEffectInfo = null;
         }
         WeaponItem weapon = new WeaponItem(dt.rows[0]["ID"].ToString(), dt.rows[0]["Name"].ToString(), dt.rows[0]["Description"].ToString(), dt.rows[0]["Icon"].ToString(), (int)dt.rows[0]["MaxCount"],
                                            float.Parse(dt.rows[0]["Weight"].ToString()), (int)dt.rows[0]["BuyPrice"], (int)dt.rows[0]["SellPrice"], (int)dt.rows[0]["SellAble"] == 1, (int)dt.rows[0]["Usable"] == 1,
                                            (MyEnums.WeaponType)dt.rows[0]["WeaponType"], (int)dt.rows[0]["ATK"], setEffectInfo);
         if (dt.rows[0]["Materials"] != null)
         {
             weapon.MaterialsListInput = dt.rows[0]["Materials"].ToString();
         }
         //Debug.Log("\"" + id + "\"" + "dasdasd");
         weapon.SetMaterials(this);
         return(weapon);
     }
     catch (System.Exception ex)
     {
         Debug.Log("\"" + id + "\"" + ex.Message);
         return(null);
     }
 }