Exemplo n.º 1
0
        private void lstSendItem_ItemChecked(object sender, ItemCheckedEventArgs e)
        {
            try
            {
                if (enableRemove)
                {
                    if (recvUserID == 0)
                    {
                        MessageBox.Show(config.ReadConfigValue("MAU", "ST_Code_msg2"));
                        enableRemove = false;
                        lstSendItem.Items[e.Item.Index].Checked = !lstSendItem.Items[e.Item.Index].Checked;
                        return;
                    }

                    OArray array = new OArray(user_Items);

                    int itemID  = int.Parse(lstSendItem.Items[e.Item.Index].Tag.ToString()); //物品编号
                    int itemSex = 0;                                                         //物品性别要求
                    for (int i = 0; i < toSendItemList.GetLength(0); i++)
                    {
                        if (toSendItemList[i, 0].oContent.ToString() == itemID.ToString())
                        {
                            itemSex = int.Parse(toSendItemList[i, 2].oContent.ToString());
                            break;
                        }
                    }
                    //选中事件
                    if (e.Item.Checked == true)
                    {
                        if (itemSex == recvUserSex || itemSex == 2)
                        {
                            user_Items = array.SaveArray(recvUserID.ToString(), itemID.ToString());
                        }
                        else
                        {
                            MessageBox.Show(config.ReadConfigValue("MAU", "ST_Code_msg3"));
                            enableRemove = false;
                            lstSendItem.Items[e.Item.Index].Checked = false;
                            return;
                        }
                    }
                    else//撤销选中
                    {
                        user_Items = array.RemoveArraySecond(recvUserID.ToString(), itemID.ToString());
                    }
                }
            }
            catch
            {
            }
        }
Exemplo n.º 2
0
        private void lstSendItem_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            try
            {
                if (recvUserID == 0)
                {
                    MessageBox.Show(config.ReadConfigValue("MAU", "ST_Code_msg2"));
                    return;
                }

                if (enableRemove)
                {
                    OArray array = new OArray(user_Items);

                    int itemID  = int.Parse(lstSendItem.Items[e.Index].Tag.ToString());      //物品编号
                    int itemSex = int.Parse(toSendItemList[e.Index, 2].oContent.ToString()); //物品性别要求
                    //选中事件
                    if (e.CurrentValue.ToString().ToLower().Equals("unchecked"))
                    {
                        if (itemSex == recvUserSex || itemSex == 2)
                        {
                            user_Items = array.SaveArray(recvUserID.ToString(), itemID.ToString());
                        }
                        else
                        {
                            MessageBox.Show(config.ReadConfigValue("MAU", "ST_Code_msg3"));
                            enableRemove = false;
                            lstSendItem.Items[e.Index].Checked = false;
                            return;
                        }
                    }
                    else//撤销选中
                    {
                        user_Items = array.RemoveArraySecond(recvUserID.ToString(), itemID.ToString());
                    }
                }
            }
            catch
            {
            }
        }
Exemplo n.º 3
0
        private void lstSendItem_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            try
            {
                if (recvUserID == 0)
                {
                    MessageBox.Show("请选择获赠玩家后再分配要赠送的物品");
                    return;
                }

                if (enableRemove)
                {
                    OArray array = new OArray(user_Items);

                    int itemID  = int.Parse(lstSendItem.Items[e.Index].Tag.ToString());      //物品编号
                    int itemSex = int.Parse(toSendItemList[e.Index, 2].oContent.ToString()); //物品性别要求
                    //选中事件
                    if (e.CurrentValue.ToString().ToLower().Equals("unchecked"))
                    {
                        if (itemSex == recvUserSex || itemSex == 2)
                        {
                            user_Items = array.SaveArray(recvUserID.ToString(), itemID.ToString());
                        }
                        else
                        {
                            MessageBox.Show("所选择的道具的性别不符,不能赠送");
                            return;
                        }
                    }
                    else//撤销选中
                    {
                        user_Items = array.RemoveArraySecond(recvUserID.ToString(), itemID.ToString());
                    }
                }
            }
            catch
            {
            }
        }