Пример #1
0
        private void CharacterSlot_MouseClick(object sender, MouseEventArgs e)
        {
            CharacterSlot senderObj = (CharacterSlot)sender;
            Character senderChar = senderObj.OChar;
            int index = CurrentAccount.Characters.IndexOf(senderChar);

            lastSelectedCharacterSlot = CurrentAccount.Characters[index];

            if (e.Button==MouseButtons.Right)
            {
                contextMenuCharacter.Show(Cursor.Position);
                return;
            }

            //Ignore if already highlighted!
            if (senderObj.IsHighlighted)return;

            for (int i = 0; i < flowlayout_Characters.Controls.Count; i++)
            {
                CharacterSlot obj=((CharacterSlot)flowlayout_Characters.Controls[i]);
                if (obj.Equals(senderObj))
                {
                    obj.IsHighlighted = true;
                    obj.Invalidate();
                    continue;
                }

                obj.IsHighlighted = false;
                obj.BackColor = Color.Transparent;
                obj.Invalidate();
            }

            panel_Items.Controls.Clear();
            InventoryControl newInv = new InventoryControl(senderChar.InventoryItems, 10, 6);
            newInv.OnItemSelected += OnItemSelected;
            newInv.Dock=DockStyle.Fill;
            panel_Items.Controls.Add(newInv);

            //Clear Item Viewer
            itemViewer.CurrentItem = null;
            itemViewer.Invalidate();

            //MessageBox.Show(CurrentAccount.Characters[index].InventoryItems.Count.ToString());
        }
Пример #2
0
        public CharacterSlot(Character c)
        {
            InitializeComponent();

            OChar = c;
            lbl_Name.Text = c.Name;

            string pathloc = Paths.RootDirectory;
            string iconname = c.GetImageIcon();

            try
            {
                pb_Image.Image = new Bitmap(Path.Combine(pathloc, "Images", "Icons", iconname));
                pb_Image.Dock=DockStyle.Fill;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error creating image!");
            }
        }
Пример #3
0
 protected bool Equals(Character other)
 {
     return string.Equals(Name, other.Name) && Class == other.Class;
 }