Ejemplo n.º 1
0
        /// <summary>
        /// Updates the given slot with the provided serialization object.
        /// </summary>
        /// <param name="slot"></param>
        /// <param name="name"></param>
        private void Import(ImplantSlots slot, string name)
        {
            // Backwards compatibility for older versions
            name = name.Replace("<", String.Empty).Replace(">", String.Empty);

            m_values[(int)slot] = StaticItems.GetImplants(slot)[name] ?? new Implant(slot);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the implant name for the given slot and the provided set.
        /// </summary>
        /// <param name="set"></param>
        /// <param name="slot"></param>
        /// <returns></returns>
        private static Implant GetImplant(SerializableSettingsImplantSet set, ImplantSlots slot)
        {
            // Invoke the property getter with the matching name through reflection
            object implantName = typeof(SerializableSettingsImplantSet).GetProperty(slot.ToString()).GetValue(set, null);

            return(StaticItems.GetImplants(slot)[(string)implantName]);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Imports data from an API serialization object.
 /// </summary>
 /// <param name="src">The source.</param>
 internal void Import(IEnumerable <SerializableNewImplant> src)
 {
     for (int i = 0; i < SlotNumbers; i++)
     {
         m_values[i] = StaticItems.GetImplants((ImplantSlots)i).FirstOrDefault(x => src.Any(y => y.ID == x.ID)) ??
                       new Implant((ImplantSlots)i);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds the combo box and label.
        /// </summary>
        /// <param name="control">The control.</param>
        private void AddComboBoxAndLabel(IDisposable control)
        {
            DropDownMouseMoveComboBox combo = control as DropDownMouseMoveComboBox;

            if (combo == null)
            {
                return;
            }

            int slotIndex;

            if (!combo.Name.Replace("cbSlot", string.Empty).TryParseInv(out slotIndex) ||
                slotIndex < 1)
            {
                return;
            }
            ImplantSlots slot = (ImplantSlots)(slotIndex - 1);

            combo.Tag                = slot;
            combo.MouseMove         += combo_MouseMove;
            combo.DropDownClosed    += combo_DropDownClosed;
            combo.DropDownMouseMove += combo_DropDownMouseMove;
            foreach (Implant implant in StaticItems.GetImplants(slot))
            {
                combo.Items.Add(implant);
            }

            Label tempLabel = null;

            try
            {
                tempLabel            = new Label();
                tempLabel.MouseMove += label_MouseMove;
                tempLabel.AutoSize   = false;
                tempLabel.Anchor     = combo.Anchor;
                tempLabel.Bounds     = combo.Bounds;
                tempLabel.TextAlign  = ContentAlignment.MiddleLeft;

                Label label = tempLabel;
                tempLabel = null;

                m_labels[(int)slot] = label;
            }
            finally
            {
                tempLabel?.Dispose();
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// On load, fill up the controls.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ImpGroups_Load(object sender, EventArgs e)
        {
            // Header
            headerLabel.Text = String.Format("{0} has the skill for {1:D} Jump Clones\n(plus 1 for the implants in your active body)",
                                             m_character, maxJumpClones);

            // Populate implants combo boxes
            foreach (var control in this.Controls)
            {
                var combo = control as DropDownMouseMoveComboBox;
                if (combo == null)
                {
                    continue;
                }

                int slotIndex = Int32.Parse(combo.Name.Replace("cbSlot", "")) - 1;
                var slot      = (ImplantSlots)slotIndex;

                combo.Tag                = (object)slot;
                combo.MouseMove         += new MouseEventHandler(combo_MouseMove);
                combo.DropDownClosed    += new EventHandler(combo_DropDownClosed);
                combo.DropDownMouseMove += new DropDownMouseMoveHandler(combo_DropDownMouseMove);
                foreach (var implant in StaticItems.GetImplants(slot))
                {
                    combo.Items.Add(implant);
                }

                var label = new Label();
                label.AutoSize      = false;
                label.Anchor        = combo.Anchor;
                label.Bounds        = combo.Bounds;
                label.TextAlign     = ContentAlignment.MiddleLeft;
                label.MouseMove    += new MouseEventHandler(label_MouseMove);
                m_labels[(int)slot] = label;
            }

            // Adds the labels
            for (int i = 0; i < 10; i++)
            {
                this.Controls.Add(m_labels[i]);
            }

            // Sets the grid rows
            setsGrid.Rows.Clear();
            AddRow(m_sets.API);
            AddRow(m_sets.OldAPI);
            foreach (var set in m_sets.CustomSets)
            {
                AddRow(set);
            }
            setsGrid.Rows[0].ReadOnly = true;
            setsGrid.Rows[1].ReadOnly = true;
            setsGrid.Rows[0].Cells[0].Style.ForeColor = SystemColors.GrayText;
            setsGrid.Rows[1].Cells[0].Style.ForeColor = SystemColors.GrayText;
            setsGrid.Rows[0].Selected = true;

            // Update the phantom row, for insertion by the user
            var phantomRow = setsGrid.Rows[setsGrid.Rows.Count - 1];

            // Update the texts
            UpdateSlots();

            // Subscribe events
            this.setsGrid.AllowUserToDeleteRows = false;
            this.setsGrid.CellValidating       += new DataGridViewCellValidatingEventHandler(this.setsGrid_CellValidating);
            this.setsGrid.RowsRemoved          += new DataGridViewRowsRemovedEventHandler(this.setsGrid_RowsRemoved);
            this.setsGrid.SelectionChanged     += new EventHandler(this.setsGrid_SelectionChanged);
            this.setsGrid.CellBeginEdit        += new DataGridViewCellCancelEventHandler(setsGrid_CellBeginEdit);
            this.Disposed += new EventHandler(OnDisposed);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Updates the given slot with the provided implant's name.
        /// </summary>
        /// <param name="slot"></param>
        /// <param name="src"></param>
        private void Import(ImplantSlots slot, SerializableImplant src)
        {
            int index = (int)slot;

            m_values[index] = (src == null ? Implant.None : StaticItems.GetImplants(slot)[src.Name]);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Updates the given slot with the provided serialization object
 /// </summary>
 /// <param name="slot"></param>
 /// <param name="serial"></param>
 private void Import(ImplantSlots slot, string name)
 {
     m_values[(int)slot] = StaticItems.GetImplants(slot)[name];
 }