Exemplo n.º 1
0
 private void BtnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         if (!CheckInputNotEmpty())
         {
             return;
         }
         bType bType = new bType();
         bType.BookType = this.tbBookTypeAdd.Text.Trim();
         int ret = new bTypeManager().AddBookType(bType);
         if (ret > 0)
         {
             BookTypeDataBind();
             MessageBox.Show(INSERTSUCCEED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show(INSERTFAILED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, OPERATIONFAILSED, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 2
0
 public BlessingItem(int id, string name, string type, float percentage, string title, int amount, int worth)
 {
     this.id         = id;
     this.name       = name;
     this.percentage = percentage;
     this.title      = title;
     this.amount     = amount;
     this.worth      = worth;
     desc            = "";
     if (type.Equals("lifesteal"))
     {
         desc     += "This offensive blessing grants bonus lifesteal. (Heals for damage dealt)\nLifesteal: " + (int)(percentage * 100) + "%";
         this.type = bType.lifesteal;
     }
     else if (type.Equals("damage"))
     {
         desc     += "This offensive blessing grants bonus damage.\nBonus Dmg.: " + (int)(percentage * 100) + "%";
         this.type = bType.damage;
     }
     else if (type.Equals("reduction"))
     {
         desc     += "This offensive blessing grants bonus damage reduction.\nDmg. Red.: " + (int)(percentage * 100) + "%";
         this.type = bType.reduction;
     }
     else if (type.Equals("crit"))
     {
         desc     += "This offensive blessing grants bonus critical strike chance.\nCrit. Chance: " + (int)(percentage * 100) + "%";
         this.type = bType.crit;
     }
     sellDesc = desc + "\nSells for: " + ((int)(worth * 0.75f)) + "g";
     buyDesc  = desc + "\nBuy for: " + ((int)(worth)) + "g";
     path     = "Items/Sprites/" + name + "sprite";
 }
Exemplo n.º 3
0
        //单击修改事件
        private void BtnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (!CheckUpdate())
                {
                    return;
                }
                bType bType = new bType();
                bType.BTypeId  = Convert.ToInt32(this.tbBookTypeId.Text.Trim());
                bType.BookType = this.tbBookTypeUpdate.Text.Trim();

                int ret = new bTypeManager().UpdateBookType(bType);
                if (ret > 0)
                {
                    BookTypeDataBind();
                    MessageBox.Show(UPDATESUCCEED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(UPDATEFAILED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, OPERATIONFAILSED, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 4
0
        // based on the string initialise block vars to appropriate values
        public Block(Game g, String fStr, Vector2 pos)
        {
            game = g;
            switch (fStr)
            {
                case "db":
                    type = bType.DIRT;
                    hitsToBreak = 6;
                    tierLvl = 1;
                    break;

                case "ab":
                    type = bType.AIR;
                    hitsToBreak = 0;
                    tierLvl = 0;
                    break;

                case "mb":
                    type = bType.MUD;
                    hitsToBreak = 10;
                    tierLvl = 1;
                    break;

                case "wb":
                    type = bType.WATER;
                    hitsToBreak = 0;
                    tierLvl = 0;
                    break;
            }
        }
Exemplo n.º 5
0
    public Blessing2Item(int id, string name, string type, float percentage, string title, int amount, int worth)
    {
        this.id         = id;
        this.name       = name;
        this.percentage = percentage;
        this.title      = title;
        this.amount     = amount;
        this.worth      = worth;
        desc            = "";

        if (type.Equals("movement"))
        {
            desc     += "This utility blessing grants bonus movement speed.\nMovespeed: " + (int)(percentage * 100) + "%";
            this.type = bType.movement;
        }
        else if (type.Equals("luck"))
        {
            desc     += "This utility blessing grants bonus rewards.\nLuck: " + (int)(percentage * 100) + "%";
            this.type = bType.luck;
        }
        sellDesc = desc + "\nSells for: " + ((int)(worth * 0.75f)) + "g";
        buyDesc  = desc + "\nBuy for: " + ((int)(worth)) + "g";

        path = "Items/Sprites/" + name + "sprite";
    }
Exemplo n.º 6
0
        public Block(Block b)
        {
            game = b.game;
            type = b.type;

            initFileString();
        }
Exemplo n.º 7
0
        public Block(Game g, bType blockType, Vector2 pos)
        {
            game = g;
            type = blockType;
            position = pos;

            initFileString();
        }
Exemplo n.º 8
0
 public int UpdateBookNum(bType btype)
 {
     try
     {
         return(bs.UpdateBookNum(btype));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 9
0
 public int AddBookType(bType btype)
 {
     try
     {
         return(bs.AddBookType(btype));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 10
0
        //根据书籍类别获取书籍类别
        public List <bType> GetbType(string bookType)
        {
            List <bType> btype = new List <bType>();
            //sql语句
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("select *");
            sb.AppendLine("from BookType");
            sb.AppendLine("where bookType like @bookType");
            sb.AppendLine("order by bTypeId desc");
            //变量赋值,设置参数
            SqlParameter[] paras =
            {
                new SqlParameter("@bookType", "%" + bookType + "%")
            };
            //创建连接对象
            SqlConnection conn = new SqlConnection(connString);

            try
            {
                //创建执行工具
                SqlCommand cmd = new SqlCommand(sb.ToString(), conn);
                //设置执行工具的参数
                cmd.Parameters.AddRange(paras);
                conn.Open();
                //执行
                SqlDataReader reader = cmd.ExecuteReader();
                //判断
                while (reader.Read())
                {
                    bType bt = new bType();
                    bt.BTypeId  = Convert.ToInt32(reader["BTypeId"]);
                    bt.BookType = Convert.ToString(reader["BookType"]);
                    btype.Add(bt);
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            //关闭数据库
            finally
            {
                conn.Close();
            }
            return(btype);
        }
Exemplo n.º 11
0
        //更改书籍类别
        public int UpdateBookType(bType btype)
        {
            //sql语句
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("update BookType");
            sb.AppendLine("set bookType=@bookType");
            sb.AppendLine("where bTypeId=@bTypeId");
            //变量赋值,设置参数
            SqlParameter[] paras =
            {
                new SqlParameter("@bookType", btype.BookType),
                new SqlParameter("@bTypeId",  btype.BTypeId)
            };
            //创建连接对象
            SqlConnection conn = new SqlConnection(connString);

            try
            {
                //创建执行工具
                SqlCommand cmd = new SqlCommand(sb.ToString(), conn);
                //设置执行工具的参数
                cmd.Parameters.AddRange(paras);
                conn.Open();
                //执行
                int result = cmd.ExecuteNonQuery();
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            //关闭数据库
            finally
            {
                conn.Close();
            }
        }
Exemplo n.º 12
0
        private void BtnNumByType_Click(object sender, EventArgs e)
        {
            try
            {
                NumByType = bm.QueryNumByType(this.cboBookType.Text.Trim());
                if (NumByType > 0)
                {
                    this.tbNumBytype.Text = Convert.ToString(NumByType);

                    bType bType = new bType();
                    bType.BookNum  = Convert.ToInt32(this.tbNumBytype.Text.Trim());
                    bType.BookType = this.cboBookType.Text.Trim();
                    new bTypeManager().UpdateBookNum(bType);
                }
                else
                {
                    MessageBox.Show(QUERYFAILED, OPERATIONWARN, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, OPERATIONFAILSED, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }