• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Chummer.StackedFocus类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Chummer.StackedFocus的典型用法代码示例。如果您正苦于以下问题:C# StackedFocus类的具体用法?C# StackedFocus怎么用?C# StackedFocus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



StackedFocus类属于Chummer命名空间,在下文中一共展示了StackedFocus类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: cmdCreateStackedFocus_Click

        private void cmdCreateStackedFocus_Click(object sender, EventArgs e)
        {
            int intFree = 0;
            List<Gear> lstGear = new List<Gear>();
            List<Gear> lstStack = new List<Gear>();

            // Run through all of the Foci the character has and count the un-Bonded ones.
            foreach (Gear objGear in _objCharacter.Gear)
            {
                if (objGear.Category == "Foci" || objGear.Category == "Metamagic Foci")
                {
                    if (!objGear.Bonded)
                    {
                        intFree++;
                        lstGear.Add(objGear);
                    }
                }
            }

            // If the character does not have at least 2 un-Bonded Foci, display an error and leave.
            if (intFree < 2)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotStackFoci"), LanguageManager.Instance.GetString("MessageTitle_CannotStackFoci"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            frmSelectItem frmPickItem = new frmSelectItem();

            // Let the character select the Foci they'd like to stack, stopping when they either click Cancel or there are no more items left in the list.
            do
            {
                frmPickItem.Gear = lstGear;
                frmPickItem.AllowAutoSelect = false;
                frmPickItem.Description = LanguageManager.Instance.GetString("String_SelectItemFocus");
                frmPickItem.ShowDialog(this);

                if (frmPickItem.DialogResult == DialogResult.OK)
                {
                    // Move the item from the Gear list to the Stack list.
                    foreach (Gear objGear in lstGear)
                    {
                        if (objGear.InternalId == frmPickItem.SelectedItem)
                        {
                            objGear.Bonded = true;
                            lstStack.Add(objGear);
                            lstGear.Remove(objGear);
                            break;
                        }
                    }
                }
            } while (lstGear.Count > 0 && frmPickItem.DialogResult != DialogResult.Cancel);

            // Make sure at least 2 Foci were selected.
            if (lstStack.Count < 2)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_StackedFocusMinimum"), LanguageManager.Instance.GetString("MessageTitle_CannotStackFoci"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            // Make sure the combined Force of the Foci do not exceed 6.
            if (!_objOptions.AllowHigherStackedFoci)
            {
                int intCombined = 0;
                foreach (Gear objGear in lstStack)
                    intCombined += objGear.Rating;
                if (intCombined > 6)
                {
                    foreach (Gear objGear in lstStack)
                        objGear.Bonded = false;
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_StackedFocusForce"), LanguageManager.Instance.GetString("MessageTitle_CannotStackFoci"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            // Create the Stacked Focus.
            StackedFocus objStack = new StackedFocus(_objCharacter);
            objStack.Gear = lstStack;
            _objCharacter.StackedFoci.Add(objStack);

            // Remove the Gear from the character and replace it with a Stacked Focus item.
            int intCost = 0;
            foreach (Gear objGear in lstStack)
            {
                intCost += objGear.TotalCost;
                _objCharacter.Gear.Remove(objGear);

                // Remove the TreeNode from Gear.
                foreach (TreeNode nodRoot in treGear.Nodes)
                {
                    foreach (TreeNode nodItem in nodRoot.Nodes)
                    {
                        if (nodItem.Tag.ToString() == objGear.InternalId)
                        {
                            nodRoot.Nodes.Remove(nodItem);
                            break;
                        }
                    }
                }
            }

//.........这里部分代码省略.........
开发者ID:cormanater,项目名称:chummer5a,代码行数:101,代码来源:frmCreate.cs


示例2: treFoci_AfterCheck

        private void treFoci_AfterCheck(object sender, TreeViewEventArgs e)
        {
            if (e.Node.Checked)
            {
                // Locate the Focus that is being touched.
                Gear objSelectedFocus = new Gear(_objCharacter);
                objSelectedFocus = _objFunctions.FindGear(e.Node.Tag.ToString(), _objCharacter.Gear);

                if (objSelectedFocus != null)
                {
                    Focus objFocus = new Focus();
                    objFocus.Name = e.Node.Text;
                    objFocus.Rating = objSelectedFocus.Rating;
                    objFocus.GearId = e.Node.Tag.ToString();
                    _objCharacter.Foci.Add(objFocus);

                    // Mark the Gear and Bonded and create an Improvements.
                    objSelectedFocus.Bonded = true;
                    if (objSelectedFocus.Equipped)
                    {
                        if (objSelectedFocus.Bonus != null)
                        {
                            if (objSelectedFocus.Extra != "")
                                _objImprovementManager.ForcedValue = objSelectedFocus.Extra;
                            _objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Gear, objSelectedFocus.InternalId, objSelectedFocus.Bonus, false, objSelectedFocus.Rating, objSelectedFocus.DisplayNameShort);

                            foreach (Power objPower in _objCharacter.Powers)
                            {
                                if (objFocus.GearId == objPower.BonusSource)
                                {
                                    objSelectedFocus.Extra = objPower.Name;
                                    break;
                                }
                            }

                            RefreshPowers();
                            _objController.PopulateFocusList(treFoci);
                        }
                    }
                }
                else
                {
                    // This is a Stacked Focus.
                    StackedFocus objStack = new StackedFocus(_objCharacter);
                    foreach (StackedFocus objCharacterFocus in _objCharacter.StackedFoci)
                    {
                        if (e.Node.Tag.ToString() == objCharacterFocus.InternalId)
                        {
                            objStack = objCharacterFocus;
                            break;
                        }
                    }

                    objStack.Bonded = true;
                    Gear objStackGear = _objFunctions.FindGear(objStack.GearId, _objCharacter.Gear);
                    if (objStackGear.Equipped)
                    {
                        foreach (Gear objGear in objStack.Gear)
                        {
                            if (objGear.Bonus != null)
                            {
                                if (objGear.Extra != "")
                                    _objImprovementManager.ForcedValue = objGear.Extra;
                                _objImprovementManager.CreateImprovements(Improvement.ImprovementSource.StackedFocus, objStack.InternalId, objGear.Bonus, false, objGear.Rating, objGear.DisplayNameShort);
                            }
                        }
                    }
                }
            }
            else
            {
                Focus objFocus = new Focus();
                foreach (Focus objCharacterFocus in _objCharacter.Foci)
                {
                    if (objCharacterFocus.GearId == e.Node.Tag.ToString())
                    {
                        objFocus = objCharacterFocus;
                        break;
                    }
                }

                // Mark the Gear as not Bonded and remove any Improvements.
                Gear objGear = new Gear(_objCharacter);
                objGear = _objFunctions.FindGear(objFocus.GearId, _objCharacter.Gear);

                if (objGear != null)
                {
                    objGear.Bonded = false;
                    _objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.Gear, objGear.InternalId);
                    _objCharacter.Foci.Remove(objFocus);
                    foreach (Power objPower in _objCharacter.Powers)
                    {
                        if (objPower.BonusSource == objGear.InternalId)
                        {
                            if (objPower.Free)
                                _objCharacter.Powers.Remove(objPower);
                            else if (objPower.FreeLevels < objPower.Rating)
                            {
                                objPower.Rating -= objPower.FreeLevels;
                                objPower.FreeLevels = 0;
//.........这里部分代码省略.........
开发者ID:cormanater,项目名称:chummer5a,代码行数:101,代码来源:frmCreate.cs


示例3: treFoci_BeforeCheck

        private void treFoci_BeforeCheck(object sender, TreeViewCancelEventArgs e)
        {
            // Don't bother to do anything since a node is being unchecked.
            if (e.Node.Checked)
                return;

            // Locate the Focus that is being touched.
            Gear objSelectedFocus = new Gear(_objCharacter);
            objSelectedFocus = _objFunctions.FindGear(e.Node.Tag.ToString(), _objCharacter.Gear);

            // Set the Focus count to 1 and get its current Rating (Force). This number isn't used in the following loops because it isn't yet checked or unchecked.
            int intFociCount = 1;
            int intFociTotal = 0;

            if (objSelectedFocus != null)
                intFociTotal = objSelectedFocus.Rating;
            else
            {
                // This is a Stacked Focus.
                StackedFocus objStack = new StackedFocus(_objCharacter);
                foreach (StackedFocus objCharacterFocus in _objCharacter.StackedFoci)
                {
                    if (e.Node.Tag.ToString() == objCharacterFocus.InternalId)
                    {
                        objStack = objCharacterFocus;
                        break;
                    }
                }
                intFociTotal = objStack.TotalForce;
            }

            // Run through the list of items. Count the number of Foci the character would have bonded including this one, plus the total Force of all checked Foci.
            foreach (TreeNode objNode in treFoci.Nodes)
            {
                if (objNode.Checked)
                {
                    intFociCount++;
                    foreach (Gear objCharacterFocus in _objCharacter.Gear)
                    {
                        if (objNode.Tag.ToString() == objCharacterFocus.InternalId)
                        {
                            intFociTotal += objCharacterFocus.Rating;
                            break;
                        }
                    }

                    foreach (StackedFocus objStack in _objCharacter.StackedFoci)
                    {
                        if (objNode.Tag.ToString() == objStack.InternalId)
                        {
                            if (objStack.Bonded)
                            {
                                intFociTotal += objStack.TotalForce;
                                break;
                            }
                        }
                    }
                }
            }

            if (intFociTotal > _objCharacter.MAG.TotalValue * 5 && !_objCharacter.IgnoreRules)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_FocusMaximumForce"), LanguageManager.Instance.GetString("MessageTitle_FocusMaximum"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                e.Cancel = true;
                return;
            }

            if (intFociCount > _objCharacter.MAG.TotalValue && !_objCharacter.IgnoreRules)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_FocusMaximumNumber"), LanguageManager.Instance.GetString("MessageTitle_FocusMaximum"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                e.Cancel = true;
            }
        }
开发者ID:cormanater,项目名称:chummer5a,代码行数:73,代码来源:frmCreate.cs


示例4: Load


//.........这里部分代码省略.........
            }

            // Cyberware/Bioware.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/cyberwares/cyberware");
            foreach (XmlNode objXmlCyberware in objXmlNodeList)
            {
                Cyberware objCyberware = new Cyberware(this);
                objCyberware.Load(objXmlCyberware);
                _lstCyberware.Add(objCyberware);
            }

            // Spells.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/spells/spell");
            foreach (XmlNode objXmlSpell in objXmlNodeList)
            {
                Spell objSpell = new Spell(this);
                objSpell.Load(objXmlSpell);
                _lstSpells.Add(objSpell);
            }

            // Foci.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/foci/focus");
            foreach (XmlNode objXmlFocus in objXmlNodeList)
            {
                Focus objFocus = new Focus();
                objFocus.Load(objXmlFocus);
                _lstFoci.Add(objFocus);
            }

            // Stacked Foci.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/stackedfoci/stackedfocus");
            foreach (XmlNode objXmlStack in objXmlNodeList)
            {
                StackedFocus objStack = new StackedFocus(this);
                objStack.Load(objXmlStack);
                _lstStackedFoci.Add(objStack);
            }

            // Powers.
            List<ListItem> lstPowerOrder = new List<ListItem>();
            objXmlNodeList = objXmlDocument.SelectNodes("/character/powers/power");
            // Sort the Powers in alphabetical order.
            foreach (XmlNode objXmlPower in objXmlNodeList)
            {
                ListItem objGroup = new ListItem();
                objGroup.Value = objXmlPower["extra"].InnerText;
                objGroup.Name = objXmlPower["name"].InnerText;

                lstPowerOrder.Add(objGroup);
            }
            objSort = new SortListItem();
            lstPowerOrder.Sort(objSort.Compare);

            foreach (ListItem objItem in lstPowerOrder)
            {
                Power objPower = new Power(this);
                XmlNode objNode = objXmlDocument.SelectSingleNode("/character/powers/power[name = " + CleanXPath(objItem.Name) + " and extra = " + CleanXPath(objItem.Value) + "]");
                objPower.Load(objNode);
                _lstPowers.Add(objPower);
            }

            // Spirits/Sprites.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/spirits/spirit");
            foreach (XmlNode objXmlSpirit in objXmlNodeList)
            {
                Spirit objSpirit = new Spirit(this);
开发者ID:ercflemng,项目名称:chummer5a,代码行数:67,代码来源:clsCharacter.cs


示例5: treFoci_BeforeCheck

        private void treFoci_BeforeCheck(object sender, TreeViewCancelEventArgs e)
        {
            if (_blnSkipRefresh)
                return;

            // If the item is being unchecked, confirm that the user wants to un-bind the Focus.
            if (e.Node.Checked)
            {
                if (MessageBox.Show(LanguageManager.Instance.GetString("Message_UnbindFocus"), LanguageManager.Instance.GetString("MessageTitle_UnbindFocus"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    e.Cancel = true;
                return;
            }

            // Locate the Focus that is being touched.
            Gear objSelectedFocus = new Gear(_objCharacter);
            objSelectedFocus = _objFunctions.FindGear(e.Node.Tag.ToString(), _objCharacter.Gear);

            // Set the Focus count to 1 and get its current Rating (Force). This number isn't used in the following loops because it isn't yet checked or unchecked.
            int intFociCount = 1;
            int intFociTotal = 0;

            if (objSelectedFocus != null)
                intFociTotal = objSelectedFocus.Rating;
            else
            {
                // This is a Stacked Focus.
                StackedFocus objStack = new StackedFocus(_objCharacter);
                foreach (StackedFocus objCharacterFocus in _objCharacter.StackedFoci)
                {
                    if (e.Node.Tag.ToString() == objCharacterFocus.InternalId)
                    {
                        objStack = objCharacterFocus;
                        break;
                    }
                }
                intFociTotal = objStack.TotalForce;
            }

            // Run through the list of items. Count the number of Foci the character would have bonded including this one, plus the total Force of all checked Foci.
            foreach (TreeNode objNode in treFoci.Nodes)
            {
                if (objNode.Checked)
                {
                    intFociCount++;
                    foreach (Gear objCharacterFocus in _objCharacter.Gear)
                    {
                        if (objNode.Tag.ToString() == objCharacterFocus.InternalId)
                        {
                            intFociTotal += objCharacterFocus.Rating;
                            break;
                        }
                    }

                    foreach (StackedFocus objStack in _objCharacter.StackedFoci)
                    {
                        if (objNode.Tag.ToString() == objStack.InternalId)
                        {
                            intFociTotal += objStack.TotalForce;
                            break;
                        }
                    }
                }
            }

            if (intFociTotal > _objCharacter.MAG.TotalValue * 5)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_FocusMaximumForce"), LanguageManager.Instance.GetString("MessageTitle_FocusMaximum"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                e.Cancel = true;
                return;
            }

            if (intFociCount > _objCharacter.MAG.TotalValue)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_FocusMaximumNumber"), LanguageManager.Instance.GetString("MessageTitle_FocusMaximum"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                e.Cancel = true;
                return;
            }

            // If we've made it this far, everything is okay, so create a Karma Expense for the newly-bound Focus.
            bool blnFound = false;
            // Locate the Gear for the Focus.
            Gear objFocus = new Gear(_objCharacter);
            foreach (Gear objGear in _objCharacter.Gear)
            {
                if (objGear.InternalId == e.Node.Tag.ToString())
                {
                    objFocus = objGear;
                    blnFound = true;
                    break;
                }
            }

            if (blnFound)
            {
                // Determine how much Karma the Focus will cost to bind.
                string strFocusName = objFocus.Name;
                if (objFocus.Extra != "")
                    strFocusName += " (" + objFocus.Extra + ")";
                int intPosition = strFocusName.IndexOf("(");
                if (intPosition > -1)
//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs


示例6: Load


//.........这里部分代码省略.........
            }

            // Cyberware/Bioware.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/cyberwares/cyberware");
            foreach (XmlNode objXmlCyberware in objXmlNodeList)
            {
                Cyberware objCyberware = new Cyberware(this);
                objCyberware.Load(objXmlCyberware);
                _lstCyberware.Add(objCyberware);
            }

            // Spells.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/spells/spell");
            foreach (XmlNode objXmlSpell in objXmlNodeList)
            {
                Spell objSpell = new Spell(this);
                objSpell.Load(objXmlSpell);
                _lstSpells.Add(objSpell);
            }

            // Foci.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/foci/focus");
            foreach (XmlNode objXmlFocus in objXmlNodeList)
            {
                Focus objFocus = new Focus();
                objFocus.Load(objXmlFocus);
                _lstFoci.Add(objFocus);
            }

            // Stacked Foci.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/stackedfoci/stackedfocus");
            foreach (XmlNode objXmlStack in objXmlNodeList)
            {
                StackedFocus objStack = new StackedFocus(this);
                objStack.Load(objXmlStack);
                _lstStackedFoci.Add(objStack);
            }

            // Powers.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/powers/power");
            foreach (XmlNode objXmlPower in objXmlNodeList)
            {
                Power objPower = new Power(this);
                objPower.Load(objXmlPower);
                _lstPowers.Add(objPower);
            }

            // Spirits/Sprites.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/spirits/spirit");
            foreach (XmlNode objXmlSpirit in objXmlNodeList)
            {
                Spirit objSpirit = new Spirit(this);
                objSpirit.Load(objXmlSpirit);
                _lstSpirits.Add(objSpirit);
            }

            // Compex Forms/Technomancer Programs.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/techprograms/techprogram");
            foreach (XmlNode objXmlProgram in objXmlNodeList)
            {
                TechProgram objProgram = new TechProgram(this);
                objProgram.Load(objXmlProgram);
                _lstTechPrograms.Add(objProgram);
            }

            // Martial Arts.
开发者ID:Nebual,项目名称:chummer,代码行数:67,代码来源:clsCharacter.cs


示例7: treFoci_AfterCheck

        private void treFoci_AfterCheck(object sender, TreeViewEventArgs e)
        {
            if (e.Node.Checked)
            {
                // Locate the Focus that is being touched.
                Gear objSelectedFocus = new Gear(_objCharacter);
                objSelectedFocus = _objFunctions.FindGear(e.Node.Tag.ToString(), _objCharacter.Gear);

                if (objSelectedFocus != null)
                {
                    Focus objFocus = new Focus();
                    objFocus.Name = e.Node.Text;
                    objFocus.Rating = objSelectedFocus.Rating;
                    objFocus.GearId = e.Node.Tag.ToString();
                    _objCharacter.Foci.Add(objFocus);

                    // Mark the Gear and Bonded and create an Improvements.
                    objSelectedFocus.Bonded = true;
                    if (objSelectedFocus.Equipped)
                    {
                        if (objSelectedFocus.Bonus != null)
                        {
                            if (objSelectedFocus.Extra != "")
                                _objImprovementManager.ForcedValue = objSelectedFocus.Extra;
                            _objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Gear, objSelectedFocus.InternalId, objSelectedFocus.Bonus, false, objSelectedFocus.Rating, objSelectedFocus.DisplayNameShort);

                            foreach (Power objPower in _objCharacter.Powers)
                            {
                                if (objFocus.GearId == objPower.BonusSource)
                                {
                                    objSelectedFocus.Extra = objPower.Name;
                                    break;
                                }
                            }

                            RefreshPowers();
                            _objController.PopulateFocusList(treFoci);
                        }
                    }
                }
                else
                {
                    // This is a Stacked Focus.
                    StackedFocus objStack = new StackedFocus(_objCharacter);
                    foreach (StackedFocus objCharacterFocus in _objCharacter.StackedFoci)
                    {
                        if (e.Node.Tag.ToString() == objCharacterFocus.InternalId)
                        {
                            objStack = objCharacterFocus;
                            break;
                        }
                    }

                    objStack.Bonded = true;
                    Gear objStackGear = _objFunctions.FindGear(objStack.GearId, _objCharacter.Gear);
                    if (objStackGear.Equipped)
                    {
                        foreach (Gear objGear in objStack.Gear)
                        {
                            if (objGear.Bonus != null)
                            {
                                if (objGear.Extra != "")
                                    _objImprovementManager.ForcedValue = objGear.Extra;
                                _objImprovementManager.CreateImprovements(Improvement.ImprovementSource.StackedFocus, objStack.InternalId, objGear.Bonus, false, objGear.Rating, objGear.DisplayNameShort);
                            }
                        }
                    }
                }
            }
            else
            {
                Focus objFocus = new Focus();
                foreach (Focus objCharacterFocus in _objCharacter.Foci)
                {
                    if (objCharacterFocus.GearId == e.Node.Tag.ToString())
                    {
                        objFocus = objCharacterFocus;
                        break;
                    }
                }

                // Mark the Gear as not Bonded and remove any Improvements.
                Gear objGear = new Gear(_objCharacter);
                objGear = _objFunctions.FindGear(objFocus.GearId, _objCharacter.Gear);

                if (objGear != null)
                {
                    objGear.Bonded = false;
                    _objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.Gear, objGear.InternalId);
                    _objCharacter.Foci.Remove(objFocus);
                    foreach (Power objPower in _objCharacter.Powers)
                    {
                        if (objPower.BonusSource == objGear.InternalId)
                        {
                            //Remove the Bonus Source since this object will not be giving a bonus
                            objPower.BonusSource = "";

                            if (objPower.Free)
                                _objCharacter.Powers.Remove(objPower);
                            else if (objPower.FreeLevels > 0)
//.........这里部分代码省略.........
开发者ID:argo2445,项目名称:chummer5a,代码行数:101,代码来源:frmCreate.cs


示例8: treFoci_AfterCheck

        private void treFoci_AfterCheck(object sender, TreeViewEventArgs e)
        {
            if (e.Node.Checked)
            {
                // Locate the Focus that is being touched.
                Gear objSelectedFocus = new Gear(_objCharacter);
                objSelectedFocus = _objFunctions.FindGear(e.Node.Tag.ToString(), _objCharacter.Gear);

                if (objSelectedFocus != null)
                {

                    Focus objFocus = new Focus();
                    objFocus.Name = e.Node.Text;
                    objFocus.Rating = objSelectedFocus.Rating;
                    objFocus.GearId = e.Node.Tag.ToString();
                    _objCharacter.Foci.Add(objFocus);

                    // Mark the Gear and Bonded and create an Improvements.
                    objSelectedFocus.Bonded = true;
                    if (objSelectedFocus.Equipped)
                    {
                        if (objSelectedFocus.Bonus != null)
                        {
                            if (objSelectedFocus.Extra != "")
                                _objImprovementManager.ForcedValue = objSelectedFocus.Extra;
                            _objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Gear, objSelectedFocus.InternalId, objSelectedFocus.Bonus, false, objSelectedFocus.Rating, objSelectedFocus.DisplayNameShort);

                            foreach (Power objPower in _objCharacter.Powers)
                            {
                                if (objFocus.GearId == objPower.BonusSource)
                                {
                                    objSelectedFocus.Extra = objPower.Name;
                                    break;
                                }
                            }

                            RefreshPowers();
                            _objController.PopulateFocusList(treFoci);
                        }
                    }
                }
                else
                {
                    // This is a Stacked Focus.
                    StackedFocus objStack = new StackedFocus(_objCharacter);
                    foreach (StackedFocus objCharacterFocus in _objCharacter.StackedFoci)
                    {
                        if (e.Node.Tag.ToString() == objCharacterFocus.InternalId)
                        {
                            objStack = objCharacterFocus;
                            break;
                        }
                    }

                    objStack.Bonded = true;
                    Gear objStackGear = _objFunctions.FindGear(objStack.GearId, _objCharacter.Gear);
                    if (objStackGear.Equipped)
                    {
                        foreach (Gear objGear in objStack.Gear)
                        {
                            if (objGear.Bonus != null)
                            {
                                if (objGear.Extra != "")
                                    _objImprovementManager.ForcedValue = objGear.Extra;
                                _objImprovementManager.CreateImprovements(Improvement.ImprovementSource.StackedFocus, objStack.InternalId, objGear.Bonus, false, objGear.Rating, objGear.DisplayNameShort);
                            }
                        }
                    }
                }
            }
            else
            {
                Focus objFocus = new Focus();
                foreach (Focus objCharacterFocus in _objCharacter.Foci)
                {
                    if (objCharacterFocus.GearId == e.Node.Tag.ToString())
                    {
                        objFocus = objCharacterFocus;
                        break;
                    }
                }

                // Mark the Gear as not Bonded and remove any Improvements.
                Gear objGear = new Gear(_objCharacter);
                objGear = _objFunctions.FindGear(objFocus.GearId, _objCharacter.Gear);

                if (objGear != null)
                {
                    objGear.Bonded = false;
                    _objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.Gear, objGear.InternalId);
                    _objCharacter.Foci.Remove(objFocus);
                    foreach (Power objPower in _objCharacter.Powers)
                    {
                        // Known issues:
                        // 1) If freelevels > MAG, AND multiple sources give free levels, the calculation for the left-over free levels
                        // will not be correct
                        // Foci give their rating / 4 in power points - use power points per level to calculate the amount of levels this
                        // focus is worth. May be troublesome in foci of non-integer power levels, but as foci should not be created
                        // with such, this will be better handled in the focus rating itself.
                        if (objPower.BonusSource == objGear.InternalId)
//.........这里部分代码省略.........
开发者ID:argo2445,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Chummer.frmExpense类代码示例发布时间:2022-05-24
下一篇:
C# Chummer.SpiritControl类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap