Exemplo n.º 1
0
 public static string AsText(this EquipmentName path)
 {
     if (mapping.Backward.ContainsKey(path))
     {
         return(mapping.Backward[path]);
     }
     throw new Exception($"Path don't exists {path.ToString()}");
 }
Exemplo n.º 2
0
            public Equipment(string ID)
            {
                Item tem_Item = null;

                foreach (Item tem in GameValue.Items.GetArray())
                {
                    if (tem.ID == ID)
                    {
                        tem_Item = tem;
                        break;
                    }
                }
                Name      = tem_Item.Name;
                Additives = tem_Item.Additives;
                Tybe      = EquipmentName.GetEquipmentTybe(Additives.GetAdditive(0).Value);
                this.ID   = ID;
            }
Exemplo n.º 3
0
        private void But_TakeOffEquipment_Click(object sender, EventArgs e)
        {
            int index = 0;

            foreach (RadioButton tem in rad_Equipments)
            {
                if (tem.Checked)
                {
                    break;
                }
                index++;
            }
            PlayerValue.Items.Add(new Item(PlayerValue.Player.Equipments.GetEquipment(EquipmentName.GetEquipmentTybe(index)).ID, 1));
            PlayerValue.Player.Equipments.DeleteEquipment(EquipmentName.GetEquipmentTybe(index));
            PlayerEquipmentReFresh();
            rad_Equipments[index].Checked = false;
            PlayerBagReFresh();
        }
Exemplo n.º 4
0
        private void Rad_Equipments_Click(object sender, EventArgs e)
        {
            int index = 0;

            foreach (RadioButton tem in rad_Equipments)
            {
                if (tem == sender)
                {
                    break;
                }
                index++;
            }
            if (rad_Equipments[index].Checked)
            {
                if (PlayerValue.Player.Equipments.GetEquipment(EquipmentName.GetEquipmentTybe(index)) == null)
                {
                    but_TakeOffEquipment.Visible = false;
                    lab_EquipmentInfo.Text       = EquipmentName.Text[index] +
                                                   "\r\n" + "未装备";
                }
                else
                {
                    but_TakeOffEquipment.Visible = true;
                    string tem_str = EquipmentName.Text[index] + "\r\n" +
                                     PlayerValue.Player.Equipments.GetEquipment(EquipmentName.GetEquipmentTybe(index)).Name + "\r\n";
                    for (int i = 0; i < 6; i++)
                    {
                        int value = PlayerValue.Player.Equipments.GetEquipment(EquipmentName.GetEquipmentTybe(index)).
                                    GetAdditive(AttributeName.GetAttributeValue(i));
                        if (value != 0)
                        {
                            tem_str += AttributeName.GetAttributeName(AttributeName.GetAttributeValue(i)) +
                                       Function.GetValueSymbol(value) + "\r\n";
                        }
                    }
                    lab_EquipmentInfo.Text = tem_str;
                }
            }
            else
            {
                lab_EquipmentInfo.Text       = "";
                but_TakeOffEquipment.Visible = false;
            }
        }
Exemplo n.º 5
0
        private void PlayerEquipmentReFresh()   //刷新玩家装备界面
        {
            Player player = PlayerValue.Player;
            int    index  = 0;

            foreach (Equipment tem in player.Equipments.GetArray())
            {
                if (tem != null)
                {
                    rad_Equipments[index].Text = EquipmentName.Text[index] + ":" + "\r\n" +
                                                 player.Equipments.GetEquipment(EquipmentName.GetEquipmentTybe(index)).Name;
                }
                else
                {
                    rad_Equipments[index].Text = EquipmentName.Text[index] + ":" + "\r\n" + "未装备";
                }
                index++;
            }
        }
        public Equipment(EquipmentName equipName, GameContent gameContent, World world)
        {
            this.gameContent = gameContent;
            this.world = world;

            this.equipName = equipName;
            BodyDef bd = new BodyDef();
            bd.type = BodyType.Dynamic;
            body = world.CreateBody(bd);

            equipmentData = gameContent.content.Load<EquipmentData>("Graphics/" + equipName.ToString());

            topLeftVertex = equipmentData.TopLeftVertex;
            origin = equipmentData.Origin;
            rotationButtonPos = equipmentData.RotationButtonPosition;

            rightClampPositionX = equipmentData.ClampData.RightClampPositionX;
            clampRotation = equipmentData.ClampData.RotationInDeg / 180f * (float)Math.PI;
            clampEnabled = equipmentData.ClampData.ClampEnabled;

            SetFixtures();

            // Collide only with Ground but not with itself and bonded Filter
            mouseFilter = new Filter();
            mouseFilter.categoryBits = 0x0002; mouseFilter.maskBits = 0x0001; mouseFilter.groupIndex = -2;

            // Collide with every thing
            groundFilter = new Filter();
            groundFilter.categoryBits = 0x0001; groundFilter.maskBits = 65535; groundFilter.groupIndex = 0;

            equipFilter = new Filter();
            equipFilter.categoryBits = 0x0002; equipFilter.maskBits = 0x0001; equipFilter.groupIndex = 2;

            //SetMode(false, false);

            body.SetUserData((EquipmentName)equipName);
        }
Exemplo n.º 7
0
 public Equipment GetEquipment(EquipmentTybe tybe)
 {
     return(Equipments[EquipmentName.GetEquipmentIndex(tybe)]);
 }
Exemplo n.º 8
0
 public void DeleteEquipment(EquipmentTybe tybe)
 {
     Equipments[EquipmentName.GetEquipmentIndex(tybe)] = null;
     Total--;
 }
Exemplo n.º 9
0
        /// <summary>
        /// Saves the equipment.
        /// </summary>
        /// <returns>Equipment Object</returns>
        public Equipment SaveEquipment()
        {
            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "InsertUpdate_Equipment";
                command.Parameters.Add(dbconn.GenerateParameterObj("@EquipmentID", SqlDbType.Int, EquipmentID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@EquipmentName", SqlDbType.VarChar, EquipmentName.ToString(), 50));
                command.Parameters.Add(dbconn.GenerateParameterObj("@EquipmentDescription", SqlDbType.VarChar, EquipmentDescription.ToString(), 400));
                command.Parameters.Add(dbconn.GenerateParameterObj("@EquipmentTypeID", SqlDbType.Int, EquipmentTypeID.ToString(), 0));

                command.Parameters.Add(dbconn.GenerateParameterObj("@EquipmentWeight", SqlDbType.Decimal, EquipmentWeight.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@EquipmentCost", SqlDbType.Int, EquipmentCost.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@BookID", SqlDbType.Int, BookID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Upgradable", SqlDbType.Bit, Upgradable.ToString(), 0));

                result = command.ExecuteReader();

                result.Read();
                SetReaderToObject(ref result);
            }
            catch
            {
                Exception e = new Exception();
                this._insertUpdateOK = false;
                this._insertUpdateMessage.Append(e.Message + "                     Inner Exception= " + e.InnerException);
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this);
        }