当前位置: 首页>>代码示例>>C#>>正文


C# Weapon.AllowMode方法代码示例

本文整理汇总了C#中Weapon.AllowMode方法的典型用法代码示例。如果您正苦于以下问题:C# Weapon.AllowMode方法的具体用法?C# Weapon.AllowMode怎么用?C# Weapon.AllowMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Weapon的用法示例。


在下文中一共展示了Weapon.AllowMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RefreshSelectedVehicle


//.........这里部分代码省略.........
                        {
                            chkVehicleHomeNode.Visible = true;
                            chkVehicleHomeNode.Checked = objGear.HomeNode;
                        }
                    }
                    else
                    {
                        // Look for the selected Vehicle Weapon.
                        Weapon objWeapon = new Weapon(_objCharacter);
                        Vehicle objCurrentVehicle = new Vehicle(_objCharacter);

                        foreach (Vehicle objVehicle in _objCharacter.Vehicles)
                        {
                            objWeapon = _objFunctions.FindWeapon(treVehicles.SelectedNode.Tag.ToString(), objVehicle.Weapons);
                            if (objWeapon != null)
                            {
                                objCurrentVehicle = objVehicle;
                                break;
                            }
                        }

                        lblVehicleWeaponName.Text = objWeapon.DisplayNameShort;
                        lblVehicleWeaponCategory.Text = objWeapon.DisplayCategory;
                        lblVehicleWeaponDamage.Text = objWeapon.CalculatedDamage();
                        lblVehicleWeaponAP.Text = objWeapon.TotalAP;
                        lblVehicleWeaponAmmo.Text = objWeapon.CalculatedAmmo();
                        lblVehicleWeaponMode.Text = objWeapon.CalculatedMode;
                        if (objWeapon.WeaponType == "Ranged" || (objWeapon.WeaponType == "Melee" && objWeapon.Ammo != "0"))
                        {
                            cmdFireVehicleWeapon.Enabled = true;
                            cmdReloadVehicleWeapon.Enabled = true;
                            lblVehicleWeaponAmmoRemaining.Text = objWeapon.AmmoRemaining.ToString();

                            cmsVehicleAmmoSingleShot.Enabled = objWeapon.AllowMode("SS") || objWeapon.AllowMode("SA");
                            cmsVehicleAmmoShortBurst.Enabled = objWeapon.AllowMode("BF");
                            cmsVehicleAmmoLongBurst.Enabled = objWeapon.AllowMode("FA");
                            cmsVehicleAmmoFullBurst.Enabled = objWeapon.AllowMode("FA");
                            cmsVehicleAmmoSuppressiveFire.Enabled = objWeapon.AllowMode("FA");

                            // Melee Weapons with Ammo are considered to be Single Shot.
                            if (objWeapon.WeaponType == "Melee" && objWeapon.Ammo != "0")
                                cmsVehicleAmmoSingleShot.Enabled = true;

                            if (cmsVehicleAmmoFullBurst.Enabled)
                                cmsVehicleAmmoFullBurst.Text = LanguageManager.Instance.GetString("String_FullBurst").Replace("{0}", objWeapon.FullBurst.ToString());
                            if (cmsVehicleAmmoSuppressiveFire.Enabled)
                                cmsVehicleAmmoSuppressiveFire.Text = LanguageManager.Instance.GetString("String_SuppressiveFire").Replace("{0}", objWeapon.Suppressive.ToString());

                            List<ListItem> lstAmmo = new List<ListItem>();
                            int intCurrentSlot = objWeapon.ActiveAmmoSlot;
                            for (int i = 1; i <= objWeapon.AmmoSlots; i++)
                            {
                                Gear objVehicleGear = new Gear(_objCharacter);
                                ListItem objAmmo = new ListItem();
                                objWeapon.ActiveAmmoSlot = i;
                                objVehicleGear = _objFunctions.FindGear(objWeapon.AmmoLoaded, objCurrentVehicle.Gear);
                                objAmmo.Value = i.ToString();

                                string strPlugins = "";
                                foreach (Vehicle objVehicle in _objCharacter.Vehicles)
                                {
                                    foreach (Gear objCurrentAmmo in objVehicle.Gear)
                                    {
                                        if (objCurrentAmmo.InternalId == objWeapon.AmmoLoaded)
                                        {
                                            foreach (Gear objChild in objCurrentAmmo.Children)
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:67,代码来源:frmCareer.cs

示例2: RefreshSelectedWeapon

        /// <summary>
        /// Refresh the information for the currently displayed Weapon.
        /// </summary>
        public void RefreshSelectedWeapon()
        {
            lblWeaponDeviceRating.Text = "";
            lblWeaponAttack.Text = "";
            lblWeaponSleaze.Text = "";
            lblWeaponDataProcessing.Text = "";
            lblWeaponFirewall.Text = "";

            bool blnClear = false;
            try
            {
                if (treWeapons.SelectedNode.Level == 0)
                    blnClear = true;
            }
            catch
            {
                blnClear = true;
            }
            if (blnClear)
            {
                lblWeaponName.Text = "";
                lblWeaponCategory.Text = "";
                lblWeaponAvail.Text = "";
                lblWeaponCost.Text = "";
                lblWeaponConceal.Text = "";
                lblWeaponAccuracy.Text = "";
                lblWeaponDamage.Text = "";
                lblWeaponRC.Text = "";
                lblWeaponAP.Text = "";
                lblWeaponReach.Text = "";
                lblWeaponMode.Text = "";
                lblWeaponAmmo.Text = "";
                lblWeaponSource.Text = "";
                cboWeaponAmmo.Enabled = false;
                tipTooltip.SetToolTip(lblWeaponSource, null);
                chkWeaponAccessoryInstalled.Enabled = false;
                chkIncludedInWeapon.Enabled = false;
                chkIncludedInWeapon.Checked = false;

                // Disable the fire button.
                cmdFireWeapon.Enabled = false;
                cmdReloadWeapon.Enabled = false;
                cmdWeaponBuyAmmo.Enabled = false;
                cboWeaponAmmo.Enabled = false;

                // Hide Weapon Ranges.
                lblWeaponRangeShort.Text = "";
                lblWeaponRangeMedium.Text = "";
                lblWeaponRangeLong.Text = "";
                lblWeaponRangeExtreme.Text = "";
                return;
            }

            lblWeaponDicePool.Text = "";
            tipTooltip.SetToolTip(lblWeaponDicePool, "");
            cmdWeaponMoveToVehicle.Enabled = false;

            // Locate the selected Weapon.
            if (treWeapons.SelectedNode.Level == 1)
            {
                Weapon objWeapon = _objFunctions.FindWeapon(treWeapons.SelectedNode.Tag.ToString(), _objCharacter.Weapons);
                if (objWeapon == null)
                    return;

                _blnSkipRefresh = true;
                lblWeaponName.Text = objWeapon.DisplayNameShort;
                lblWeaponCategory.Text = objWeapon.DisplayCategory;
                string strBook = _objOptions.LanguageBookShort(objWeapon.Source);
                string strPage = objWeapon.Page;
                lblWeaponSource.Text = strBook + " " + strPage;
                tipTooltip.SetToolTip(lblWeaponSource, _objOptions.LanguageBookLong(objWeapon.Source) + " " + LanguageManager.Instance.GetString("String_Page") + " " + objWeapon.Page);
                chkWeaponAccessoryInstalled.Enabled = false;
                chkIncludedInWeapon.Enabled = false;
                chkIncludedInWeapon.Checked = false;

                // Do not allow Cyberware of Gear Weapons to be moved.
                if (!objWeapon.Cyberware && objWeapon.Category != "Gear")
                {
                    if (_objCharacter.Vehicles.Count > 0)
                        cmdWeaponMoveToVehicle.Enabled = true;
                    else
                        cmdWeaponMoveToVehicle.Enabled = false;
                }

                // Enable the fire button if the Weapon is Ranged.
                if (objWeapon.WeaponType == "Ranged" || (objWeapon.WeaponType == "Melee" && objWeapon.Ammo != "0"))
                {
                    cmdFireWeapon.Enabled = true;
                    cmdReloadWeapon.Enabled = true;
                    cmdWeaponBuyAmmo.Enabled = true;
                    lblWeaponAmmoRemaining.Text = objWeapon.AmmoRemaining.ToString();
                    //lblWeaponAmmoType.Text = "External Source";

                    cmsAmmoSingleShot.Enabled = objWeapon.AllowMode(LanguageManager.Instance.GetString("String_ModeSingleShot")) || objWeapon.AllowMode(LanguageManager.Instance.GetString("String_ModeSemiAutomatic"));
                    cmsAmmoShortBurst.Enabled = objWeapon.AllowMode(LanguageManager.Instance.GetString("String_ModeBurstFire")) || objWeapon.AllowMode(LanguageManager.Instance.GetString("String_ModeFullAutomatic"));
                    cmsAmmoLongBurst.Enabled = objWeapon.AllowMode(LanguageManager.Instance.GetString("String_ModeFullAutomatic"));
                    cmsAmmoFullBurst.Enabled = objWeapon.AllowMode(LanguageManager.Instance.GetString("String_ModeFullAutomatic"));
//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs


注:本文中的Weapon.AllowMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。