Example #1
0
 public SuitEffectInfo GetSuitEffectInfo(string id)
 {
     try
     {
         if (string.IsNullOrEmpty(id))
         {
             return(null);
         }
         string ID = "'" + id + "'";
         SimpleSQL.SimpleDataTable dt = dbManager.QueryGeneric(
             "SELECT " + "*" +
             "FROM " +
             "SuitEffect " +
             "WHERE " + "SuitID LIKE " + ID
             );
         PowerUps       ups1          = new PowerUps(dt.rows[0]["PowerUps1"].ToString());
         PowerUps       ups2          = new PowerUps(dt.rows[0]["PowerUps2"].ToString());
         SuitEffectInfo setEffectInfo = new SuitEffectInfo(dt.rows[0]["SuitID"].ToString(), dt.rows[0]["SuitName"].ToString(), ups1, ups2, (int)dt.rows[0]["Suit1Num"], (int)dt.rows[0]["Suit2Num"]);
         return(setEffectInfo);
     }
     catch (System.Exception ex)
     {
         Debug.Log("\"" + id + "\"" + ex.Message);
         return(null);
     }
 }
Example #2
0
 public ItemBase GetOtherItem(string id)
 {
     try
     {
         if (string.IsNullOrEmpty(id))
         {
             return(null);
         }
         string ID = "'" + id + "'";
         SimpleSQL.SimpleDataTable dt = dbManager.QueryGeneric(
             "SELECT " + "*" +
             "FROM " +
             "OtherItem " +
             "WHERE " + "ID LIKE " + ID
             );
         ItemBase item = new ItemBase(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);
         if (dt.rows[0]["Materials"] != null)
         {
             item.MaterialsListInput = dt.rows[0]["Materials"].ToString();
         }
         item.SetMaterials(this);
         return(item);
     }
     catch (System.Exception ex)
     {
         Debug.Log("\"" + id + "\"" + ex.Message);
         return(null);
     }
 }
Example #3
0
 public MedicineItem GetMedicineItem(string id)
 {
     try
     {
         if (string.IsNullOrEmpty(id))
         {
             return(null);
         }
         string ID = "'" + id + "'";
         SimpleSQL.SimpleDataTable dt = dbManager.QueryGeneric(
             "SELECT " + "*" +
             "FROM " +
             "MedicineItem " +
             "WHERE " + "ID LIKE " + ID
             );
         MedicineItem medicine = new MedicineItem(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,
                                                  dt.rows[0]["HP_Rec"] == null ? 0 : (int)dt.rows[0]["HP_Rec"], dt.rows[0]["MP_Rec"] == null ? 0 : (int)dt.rows[0]["MP_Rec"], dt.rows[0]["Endurance_Rec"] == null ? 0 : (int)dt.rows[0]["Endurance_Rec"]);
         if (dt.rows[0]["Materials"] != null)
         {
             medicine.MaterialsListInput = dt.rows[0]["Materials"].ToString();
         }
         medicine.SetMaterials(this);
         return(medicine);
     }
     catch (System.Exception ex)
     {
         Debug.Log("\"" + id + "\"" + ex.Message);
         return(null);
     }
 }
    public void OnClickLast()
    {
        string tableName = GetSelectTableName();

        SimpleSQL.SimpleDataTable retMaxFixId = MasterFinder <Master> .Instance.QueryGeneric(string.Format("select MAX(fix_id) as fix_id from {0}  ", tableName), "");

        if (retMaxFixId != null)
        {
            SetContent(Convert.ToUInt32(retMaxFixId.rows[0][0]));
        }
#if BUILD_TYPE_DEBUG
        Debug.Log("CALL OnClickLast");
#endif
    }
    public void OnClickNext()
    {
        string tableName = GetSelectTableName();

        SimpleSQL.SimpleDataTable retNextFixId = MasterFinder <Master> .Instance.QueryGeneric(string.Format("select MIN(fix_id) as next_fix_id from {0} where fix_id > ? ", tableName), Convert.ToUInt32(fixIdInputField.text));

        if (retNextFixId != null && retNextFixId.rows[0][0] != null)
        {
            SetContent(Convert.ToUInt32(retNextFixId.rows[0][0]));
        }
#if BUILD_TYPE_DEBUG
        Debug.Log("CALL OnClickNext");
#endif
    }
Example #6
0
    void Start()
    {
        // Gather a list of weapons and their type names pulled from the weapontype table
        SimpleSQL.SimpleDataTable dt = dbManager.QueryGeneric(
            "SELECT " +
            "W.WeaponID, " +
            "W.WeaponName, " +
            "W.Damage, " +
            "W.Cost, " +
            "W.Weight, " +
            "W.WeaponTypeID, " +
            "T.Description AS WeaponTypeDescription " +
            "FROM " +
            "Weapon W " +
            "JOIN WeaponType T " +
            "ON W.WeaponTypeID = T.WeaponTypeID " +
            "ORDER BY " +
            "W.WeaponID "
            );

        // output the list of weapons
        // note that we can reference the field/column by number (the order in the SELECT list, starting with zero) or by name
        outputText.text = "Weapons\n\n";
        int rowIndex = 0;

        foreach (SimpleSQL.SimpleDataRow dr in dt.rows)
        {
            outputText.text += "<color=#1abc9c>Name:</color> '" + dr[1].ToString() + "' " +
                               "<color=#1abc9c>Damage:</color>" + dr["Damage"].ToString() + " " +
                               "<color=#1abc9c>Cost:</color>" + dr[3].ToString() + " " +
                               "<color=#1abc9c>Weight:</color>" + dr["Weight"].ToString() + " " +
                               "<color=#1abc9c>Type:</color>" + dr[6] + "\n";

            rowIndex++;
        }


        // get the weapon record that has a WeaponID > 4 with a single statement
        // warning, this will fail if no record exists, so we use a try catch block
        outputText.text += "\nFirst record where the WeaponID > 4: ";
        try
        {
            outputText.text += dbManager.QueryGeneric("SELECT WeaponName FROM Weapon WHERE WeaponID > 4").rows[0][0].ToString() + "\n";
        }
        catch
        {
            outputText.text += "No record found\n";
        }
    }
    public void SetContent(uint fixId)
    {
        string tableName = GetSelectTableName();

        SimpleSQL.SimpleDataTable result = MasterFinder <Master> .Instance.QueryGeneric(string.Format("select * from {0} where fix_id = ? ", tableName), fixId);

        String ContentTmp = "";

        for (int r = 0; r < result.rows.Count; r++)
        {
            for (int c = 0; c < result.columns.Count; c++)
            {
                ContentTmp += result.columns[c].name + " :\n" + result.rows[r][c].ToString() + "\n\n";
            }
        }
        Content = ContentTmp;
        fixIdInputField.text = fixId.ToString();
    }
    private void createTables()
    {
        string sql = "SELECT name FROM sqlite_master WHERE type='table' AND name='ChunkDataDO' ";

        SimpleSQL.SimpleDataTable dt = dbManager.QueryGeneric(sql);

        bool found = false;

        foreach (SimpleSQL.SimpleDataRow dr in dt.rows)
        {
            if (dr [0].ToString() == "ChunkDataDO")
            {
                found = true;
                break;
            }
        }
        if (!found)
        {
            sql = "CREATE TABLE 'ChunkDataDO' " +
                  "('x' INTEGER NOT NULL, " +
                  " 'y' INTEGER NOT NULL, " +
                  " 'z' INTEGER NOT NULL, " +
                  " 'blocks' BLOB NOT NULL," +
                  " PRIMARY KEY ( 'x','y','z')) ";

            dbManager.Execute(sql);
        }
        //Insert a chunk
        ChunkData.ChunkDataDO d = new ChunkData.ChunkDataDO();
        d.x      = 2;
        d.y      = 2;
        d.z      = 2;
        d.blocks = "testset";
        dbManager.Insert(d);

        List <ChunkData.ChunkDataDO> data = dbManager.Query <ChunkData.ChunkDataDO> ("SELECT * FROM ChunkDataDO");

        foreach (ChunkData.ChunkDataDO chunk in data)
        {
            Debug.Log(chunk.x + "," + chunk.y + "," + chunk.z);
        }
    }
Example #9
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);
     }
 }
Example #10
0
 public JewelryItem GetJewelryItem(string id)
 {
     try
     {
         if (string.IsNullOrEmpty(id))
         {
             return(null);
         }
         string ID = "'" + id + "'";
         SimpleSQL.SimpleDataTable dt = dbManager.QueryGeneric(
             "SELECT " + "*" +
             "FROM " +
             "JewelryItem " +
             "WHERE " + "ID LIKE " + ID
             );
         PowerUps       ups = new PowerUps(dt.rows[0]["PowerUps"].ToString());
         SuitEffectInfo setEffectInfo;
         if (dt.rows[0]["Suit"] != null)
         {
             setEffectInfo = GetSuitEffectInfo(dt.rows[0]["Suit"].ToString());
         }
         else
         {
             setEffectInfo = null;
         }
         JewelryItem jewelry = new JewelryItem(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.JewelryType)dt.rows[0]["JewelryType"], ups, setEffectInfo);
         if (dt.rows[0]["Materials"] != null)
         {
             jewelry.MaterialsListInput = dt.rows[0]["Materials"].ToString();
         }
         jewelry.SetMaterials(this);
         return(jewelry);
     }
     catch (System.Exception ex)
     {
         Debug.Log("\"" + id + "\"" + ex.Message);
         return(null);
     }
 }
Example #11
0
 public SimpleSQL.SimpleDataTable SelectColumnWhere(string ColumnText, string WhereText, params object[] args)
 {
     SimpleSQL.SimpleDataTable result = SQLiteClient.Instance.QueryGeneric(string.Format("select{0} from {1} {2}", ColumnText, TableName, WhereText), args);
     return(result);
 }
Example #12
0
 public SimpleSQL.SimpleDataTable SelectCountWhere(string WhereText, params object[] args)
 {
     SimpleSQL.SimpleDataTable result = SQLiteClient.Instance.QueryGeneric(string.Format("select count(*) as count from {0} {1}", TableName, WhereText), args);
     return(result);
 }
Example #13
0
 public SimpleSQL.SimpleDataTable QueryGeneric(string QueryText, params object[] args)
 {
     SimpleSQL.SimpleDataTable result = SQLiteClient.Instance.QueryGeneric(QueryText, args);
     return(result);
 }
Example #14
0
    public Dictionary <EMASTERDATA, uint> GetMaxTagIdDict()
    {
        Dictionary <EMASTERDATA, uint> dict = new Dictionary <EMASTERDATA, uint>();

        // テーブルを空の状態にして再取得する必要なマスターを設定する
        List <EMASTERDATA> zeroTagList = new List <EMASTERDATA>
        {
            EMASTERDATA.eMASTERDATA_INFORMATION,
            EMASTERDATA.eMASTERDATA_GACHA,
            EMASTERDATA.eMASTERDATA_NOTIFICATION,
            EMASTERDATA.eMASTERDATA_EVENT,
            EMASTERDATA.eMASTERDATA_QUEST_APPEARANCE,
            EMASTERDATA.eMASTERDATA_STEP_UP_GACHA_MANAGE,
            EMASTERDATA.eMASTERDATA_PRESENT_GROUP,
        };

        foreach (var d in MasterDataDefine.SQLiteHoldList())
        {
            if (zeroTagList.Contains(d))
            {
                dbManager.Execute("delete from " + MasterDataDefine.GetTableName(d));
                dict.Add(d, (uint)0);
                continue;
            }

            try
            {
                SimpleSQL.SimpleDataTable t = dbManager.QueryGeneric("select max(tag_id) as max_tag_id from  " + d.GetTableName());

                if (t == null)
                {
                    dict.Add(d, (uint)0);
                    continue;
                }

                List <SimpleSQL.SimpleDataRow> rows = t.rows;
                if (rows.Count > 0)
                {
                    object obj = rows[0]["max_tag_id"];
                    if (obj != null)
                    {
                        int maxTagId = obj.ToString().ToInt(0);

                        dict.Add(d, (uint)maxTagId);
                    }
                    else
                    {
                        dict.Add(d, (uint)0);
                    }
                }
                else
                {
                    dict.Add(d, (uint)0);
                }
            }
            catch (Exception e)
            {
                Debug.LogError("E:" + e.StackTrace + " ::" + d.ToString());
                dict.Add(d, (uint)0);
            }
        }

        return(dict);
    }
Example #15
0
 /// <summary>
 /// The row initializer is passed the SimpleDataTable so that
 /// we can reference the column structure.
 /// </summary>
 /// <param name="dt"></param>
 public SimpleDataRow(SimpleDataTable dt)
 {
     _dt = dt;
 }