Exemplo n.º 1
0
        private void listViewEx1_MouseDown(object sender, MouseEventArgs e)
        {
            VirtualListView listViewEx = CurrentListView();

            if (e.Clicks == 2 && e.Button == MouseButtons.Left)
            {
                ListViewItem item = listViewEx.GetItemAt(e.X, e.Y);
                if (item == null)
                {
                    return;
                }

                int             id   = int.Parse(item.SubItems[8].Text);
                CardDescription card = CardLibrary.GetInstance().GetCardByID(id);

                if (CardDescription.isExtraCard(card))
                {
                    Global.frmDeckEditHolder.AddToFusionDeck(card.ID);
                }
                else
                {
                    Global.frmDeckEditHolder.AddToMainDeck(card.ID);
                }
            }
        }
Exemplo n.º 2
0
        private void listViewEx1_ItemDrag(object sender, ItemDragEventArgs e)
        {
            if (!string.Equals(DB2Config.GetInstance().GetSetting("NoDrag"), "True", StringComparison.OrdinalIgnoreCase) && e.Button == MouseButtons.Left)
            {
                Application.DoEvents();

                VirtualListView ListViewEx = (VirtualListView)sender;
                ListViewItem    item       = (ListViewItem)e.Item;//listViewEx1.GetItemAt(e.X, e.Y);
                if (item == null)
                {
                    return;
                }

                if (item.Selected == false)
                {
                    item.Selected = true;
                    listViewEx1.Update();
                }

                DragCard dragcard = new DragCard();
                int      id       = int.Parse(item.SubItems[8].Text);
                dragcard.Card       = CardLibrary.GetInstance().GetCardByID(id);
                dragcard.FromObject = ListViewEx;
                ListViewEx.DoDragDrop(dragcard, DragDropEffects.Copy);
            }
        }
Exemplo n.º 3
0
        //切换视图
        private void buttonItem17_Click(object sender, EventArgs e)
        {
            VirtualListView listViewEx1 = CurrentListView();

            if (listViewEx1 == null)
            {
                return;
            }

            bool largeicon = true;

            if (listViewEx1.View == View.LargeIcon)
            {
                largeicon = false;
            }

            if (!listViewEx1.VirtualMode)
            {
                CardDescription[] Cards = CurrentCards();
                for (int i = 0; i < listViewEx1.Items.Count; i++)
                {
                    listViewEx1.Items[i].ImageIndex = ListViewItemFactory.GetImageIndexByID(Cards[i].ID, largeicon);
                }
            }

            if (largeicon)
            {
                listViewEx1.View = View.LargeIcon;
            }
            else
            {
                listViewEx1.View = View.Details;
            }
        }
Exemplo n.º 4
0
        private void ShowDeckList(CardDescription[] Cards, VirtualListView listview)
        {
            ListViewItem[] resultItem = new ListViewItem[Cards.Length];
            for (int i = 0; i < Cards.Length; i++)
            {
                CardDescription card = Cards[i];

                bool largeicon = false;
                if (listViewEx1.View == View.LargeIcon)
                {
                    largeicon = true;
                }

                resultItem[i] = ListViewItemFactory.GetItemByCard(card, largeicon);
            }

            listview.BeginUpdate();
            if (listview.VirtualMode)
            {
                View v = listview.View;
                listview.View            = View.List;
                listview.VirtualListSize = Cards.Length;
                listview.View            = v;
            }
            else
            {
                listview.Items.Clear();
                listview.Items.AddRange(resultItem);
            }
            listview.EndUpdate();
        }
Exemplo n.º 5
0
        private void buttonItem17_Click(object sender, EventArgs e)
        {
            VirtualListView listViewEx1 = CurrentListView();

            if (listViewEx1.View == View.Details)
            {
                if (!listViewEx1.VirtualMode)
                {
                    CardDescription[] cards = CurrentCards();
                    for (int i = 0; i < listViewEx1.Items.Count; i++)
                    {
                        listViewEx1.Items[i].ImageIndex = Global.largePicLoader.GetImageIndex(cards[i].ID);
                    }
                }
                listViewEx1.View = View.LargeIcon;
            }
            else
            {
                if (!listViewEx1.VirtualMode)
                {
                    CardDescription[] cards = CurrentCards();
                    for (int i = 0; i < listViewEx1.Items.Count; i++)
                    {
                        listViewEx1.Items[i].ImageIndex = cards[i].iCardtype;
                    }
                }
                listViewEx1.View = View.Details;
            }
        }
Exemplo n.º 6
0
        private void buttonItem30_Click(object sender, EventArgs e)
        {
            VirtualListView listViewEx = CurrentListView();

            CardDescription[] Cards = CurrentCards();
            if (listViewEx.SelectedIndices == null || listViewEx.SelectedIndices.Count == 0)
            {
                return;
            }
            CardDescription card = Cards[listViewEx.SelectedIndices[0]];

            Global.frmDeckEditHolder.AddToTempDeck(card.ID);
        }
Exemplo n.º 7
0
        private void buttonItem2_PopupOpen(object sender, DevComponents.DotNetBar.PopupOpenEventArgs e)
        {
            VirtualListView listViewEx = CurrentListView();

            CardDescription[] Cards = CurrentCards();

            if (listViewEx.SelectedIndices == null || listViewEx.SelectedIndices.Count == 0)
            {
                buttonItem28.Enabled = false;
                buttonItem29.Enabled = false;
                buttonItem30.Enabled = false;
            }
            else
            {
                CardDescription card = null;
                try
                {
                    card = Cards[listViewEx.SelectedIndices[0]];
                }
                catch
                {
                    card = null;
                }
                if (card == null)
                {
                    buttonItem6.Enabled = false;
                    buttonItem7.Enabled = false;
                    buttonItem8.Enabled = false;
                    return;
                }

                if (CardDescription.isExtraCard(card))
                {
                    buttonItem28.Text    = "至额外卡组";
                    buttonItem28.Enabled = true;
                    buttonItem29.Enabled = true;
                    buttonItem30.Enabled = true;
                }
                else
                {
                    buttonItem28.Enabled = true;
                    buttonItem29.Enabled = true;
                    buttonItem30.Enabled = true;
                }
            }
        }
Exemplo n.º 8
0
        private void buttonItem28_Click(object sender, EventArgs e)
        {
            VirtualListView listViewEx = CurrentListView();

            CardDescription[] Cards = CurrentCards();
            if (listViewEx.SelectedIndices == null || listViewEx.SelectedIndices.Count == 0)
            {
                return;
            }
            CardDescription card = Cards[listViewEx.SelectedIndices[0]];

            if (CardDescription.isExtraCard(card))
            {
                Global.frmDeckEditHolder.AddToFusionDeck(card.ID);
            }
            else
            {
                Global.frmDeckEditHolder.AddToMainDeck(card.ID);
            }
        }
Exemplo n.º 9
0
        private void ShowDeckList(CardDescription[] Cards, VirtualListView listview)
        {
            ListViewItem[] resultItem = new ListViewItem[Cards.Length];
            for (int i = 0; i < Cards.Length; i++)
            {
                CardDescription card    = Cards[i];
                ListViewItem    tmpItem = new ListViewItem();
                tmpItem.Text = card.name;
                //tmpItem.UseItemStyleForSubItems = false;
                Color color = tmpItem.ForeColor;
                switch (card.iCardtype)
                {
                case 0:
                    color = Color.OrangeRed;
                    break;

                case 4:
                    color = Color.Green;
                    break;

                case 5:
                    color = Color.Fuchsia;
                    break;

                case 1:
                    color = Color.SandyBrown;
                    break;

                case 2:
                    color = Color.DarkOrchid;
                    break;

                case 3:
                    color = Color.DodgerBlue;
                    break;

                case 6:
                    color = Color.DarkSlateGray;
                    break;
                }
                tmpItem.ForeColor = color;
                tmpItem.SubItems.Add(card.japName);
                tmpItem.SubItems.Add(card.sCardType);
                tmpItem.SubItems.Add(card.tribe);
                tmpItem.SubItems.Add(card.element);
                if (card.level > 0)
                {
                    tmpItem.SubItems.Add(card.level.ToString());
                }
                else
                {
                    tmpItem.SubItems.Add("");
                }
                tmpItem.SubItems.Add(card.atk);
                tmpItem.SubItems.Add(card.def);
                tmpItem.SubItems.Add(card.ID.ToString());

                if (!listview.VirtualMode)
                {
                    if (listview.View == View.Details)
                    {
                        tmpItem.ImageIndex = card.iCardtype;
                    }
                    else
                    {
                        tmpItem.ImageIndex = Global.largePicLoader.GetImageIndex(card.ID);
                    }
                }
                //listView1.Items.Add(tmpItem);
                resultItem[i] = tmpItem;
            }

            listview.BeginUpdate();
            if (listview.VirtualMode)
            {
                View v = listview.View;
                listview.View            = View.List;
                listview.VirtualListSize = Cards.Length;
                listview.View            = v;
            }
            else
            {
                listview.Items.Clear();
                listview.Items.AddRange(resultItem);
            }
            listview.EndUpdate();
        }