コード例 #1
0
ファイル: SMain.cs プロジェクト: coolzoom/mir2-master
        private void GuildListView_DoubleClick(object sender, EventArgs e)
        {
            ListViewNF list = (ListViewNF)sender;

            if (list.SelectedItems.Count > 0)
            {
                ListViewItem item  = list.SelectedItems[0];
                int          index = Int32.Parse(item.Text);

                Server.MirObjects.GuildObject Guild = Envir.GetGuild(index);

                MirForms.GuildItemForm form = new MirForms.GuildItemForm()
                {
                    GuildName = Guild.Name,
                    main      = this,
                };

                if (Guild == null)
                {
                    return;
                }

                foreach (var i in Guild.StoredItems)
                {
                    if (i == null)
                    {
                        continue;
                    }
                    ListViewItem tempItem = new ListViewItem(i.Item.UniqueID.ToString())
                    {
                        Tag = this
                    };

                    Server.MirDatabase.CharacterInfo character = Envir.GetCharacterInfo((int)i.UserId);
                    if (character != null)
                    {
                        tempItem.SubItems.Add(character.Name);
                    }
                    else if (i.UserId == -1)
                    {
                        tempItem.SubItems.Add("Server");
                    }
                    else
                    {
                        tempItem.SubItems.Add("Unknown");
                    }

                    tempItem.SubItems.Add(i.Item.Name);
                    tempItem.SubItems.Add(i.Item.Count.ToString());
                    tempItem.SubItems.Add(i.Item.CurrentDura.ToString() + "/" + i.Item.MaxDura.ToString());

                    form.GuildItemListView.Items.Add(tempItem);
                }

                foreach (var r in Guild.Ranks)
                {
                    foreach (var m in r.Members)
                    {
                        ListViewItem tempItem = new ListViewItem(m.name)
                        {
                            Tag = this
                        };
                        tempItem.SubItems.Add(r.Name);
                        form.MemberListView.Items.Add(tempItem);
                    }
                }


                form.ShowDialog();
            }
        }