예제 #1
0
 public static void GetFriendsInfo(ref FriendsInfo info)
 {
     BattleNet.s_impl.GetFriendsInfo(ref info);
 }
예제 #2
0
        /// <summary>
        /// 添加友情连接
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            string title = txtTitle.Text.Trim();
            string alt   = this.txtAlt.Text.Trim();
            string url   = this.txtLinkUrl.Text.Trim();
            string spic  = "";

            if (this.FileUpload1.PostedFile != null && FileUpload1.PostedFile.FileName != "")
            {
                if (!Directory.Exists(Server.MapPath(Global_Upload.FriendImgPath)))         //判断目录是否存在
                {
                    Directory.CreateDirectory(Server.MapPath(Global_Upload.FriendImgPath)); //创建目录
                }
                spic = DoClass.UploadFile(FileUpload1.PostedFile, Global_Upload.Imgsize, Global_Upload.ImgType, Global_Upload.FriendImgPath);

                if (spic == "-1")
                {
                    return;
                }
                else if (spic == "0")
                {
                    return;
                }
                else
                {
                    ViewState["img1Name"] = spic;
                    spic = Global_Upload.FriendImgPath + spic;
                    ViewState["newsImg1"] = spic;
                    lblURL1.Text          = spic;
                }
            }
            if (this.FileUpload2.PostedFile != null && FileUpload2.PostedFile.FileName != "")
            {
                if (!Directory.Exists(Server.MapPath(Global_Upload.FriendImgPath)))         //判断目录是否存在
                {
                    Directory.CreateDirectory(Server.MapPath(Global_Upload.FriendImgPath)); //创建目录
                }
                spic = DoClass.UploadFile(FileUpload2.PostedFile, Global_Upload.Imgsize, Global_Upload.ImgType, Global_Upload.FriendImgPath);

                if (spic == "-1")
                {
                    return;
                }
                else if (spic == "0")
                {
                    return;
                }
                else
                {
                    ViewState["img2Name"] = spic;
                    spic = Global_Upload.FriendImgPath + spic;
                    ViewState["newsImg2"] = spic;
                    lblURL2.Text          = spic;
                }
            }
            FriendsInfo item = new FriendsInfo();

            item.title    = title;
            item.alt      = alt;
            item.linkurl  = url;
            item.img1path = "";
            item.img2Path = "";
            if (ViewState["newsImg1"] != null || lblURL1.Text != "")
            {
                item.img1path = lblURL1.Text;
            }
            else
            {
                lblError.Text = "请上传图片1";
                return;
            }

            item.addTime  = DateTime.Now;
            item.status   = 0;
            item.infoType = 0;
            if (ViewState["typeId"] != null)
            {
                item.infoType = Convert.ToInt32(ViewState["typeId"]);
            }
            item.orderNum = 0;
            if (txtOrder.Text.Trim() != "")
            {
                if (RegExp.IsNumeric(txtOrder.Text.Trim()))
                {
                    item.orderNum = Convert.ToInt32(txtOrder.Text.Trim());
                }
            }
            item.addUser = 0;
            AdminUser au = Session["loginUser"] as AdminUser;

            if (au != null)
            {
                item.addUser = au.id;
            }
            if (lblId.Text != "")
            {
                item.id = Convert.ToInt32(lblId.Text.Trim());
                int num = FriendsInfoService.Update(item);
            }
            else
            {
                int num = FriendsInfoService.Add(item);
            }
            pnlAdd.Visible  = false;
            pnlList.Visible = true;
            LoadData();
        }
예제 #3
0
    /// <summary>
    /// 接收好友链表
    /// </summary>
    protected void S2C_GetFriendsList(Pt pt)
    {
        pt_friend_relation_list_d705 msg = pt as pt_friend_relation_list_d705;

        if (msg != null)
        {
            //for (int j = 0; j < msg.relation_list.Count; j++)
            //{
            //    Debug.Log("d705    add_or_remove:  " + msg.add_or_remove + "   , type : " + msg.relation_list[j].type + "   ,  uid : " + msg.relation_list[j].uid + "   , name : " + msg.relation_list[j].name + "   ,lev : " + msg.relation_list[j].lev + "  " + ConfigMng.Instance.GetLevelDes(msg.relation_list[j].lev));
            //}
            if (isAddInAdvice && msg.add_or_remove == 1)//将好友推送中的人添加到好友列表,删除好友推送中的人
            {
                for (int i = 0, max = msg.relation_list.Count; i < max; i++)
                {
                    if (friendsDic.ContainsKey(msg.relation_list[i].uid))
                    {
                        friendsDic.Remove(msg.relation_list[i].uid);
                    }
                }
            }
            else if (msg.add_or_remove == 1)//添加
            {
                if (msg.relation_list.Count > 0)
                {
                    int type = msg.relation_list[0].type;

                    if (!allFriendDic.ContainsKey(type))
                    {
                        allFriendDic[type] = new FDictionary();
                    }
                    for (int i = 0, max = msg.relation_list.Count; i < max; i++)
                    {
                        FriendsInfo info = new FriendsInfo(msg.relation_list[i]);
                        if (!allFriendDic[type].ContainsKey(msg.relation_list[i].uid))
                        {
                            allFriendDic[type][msg.relation_list[i].uid] = info;
                        }
                    }
                }
                for (int i = 0, max = msg.relation_list.Count; i < max; i++)
                {
                    if (!friendsDic.ContainsKey(msg.relation_list[i].uid))
                    {
                        friendsDic[msg.relation_list[i].uid] = new FriendsInfo(msg.relation_list[i]);
                    }
                }
            }
            else if (msg.add_or_remove == 2)//移除
            {
                if (msg.relation_list.Count > 0)
                {
                    int type = msg.relation_list[0].type;

                    if (allFriendDic.ContainsKey(type))
                    {
                        for (int i = 0, max = msg.relation_list.Count; i < max; i++)
                        {
                            if (allFriendDic[type].ContainsKey(msg.relation_list[i].uid))
                            {
                                allFriendDic[type].Remove(msg.relation_list[i].uid);
                            }
                        }
                    }
                }

                for (int i = 0, max = msg.relation_list.Count; i < max; i++)
                {
                    if (friendsDic.ContainsKey(msg.relation_list[i].uid))
                    {
                        friendsDic.Remove(msg.relation_list[i].uid);
                    }
                }
            }
            else//链表
            {
                curFriend = null;
                friendsDic.Clear();
                for (int i = 0, max = msg.relation_list.Count; i < max; i++)
                {
                    relation_list data = msg.relation_list[i];
                    if (!friendsDic.ContainsKey(data.uid))
                    {
                        friendsDic[data.uid] = new FriendsInfo(data);
                    }
                    else
                    {
                        FriendsInfo info = friendsDic[data.uid] as FriendsInfo;
                        info.Updata(data);
                    }
                }
                if (msg.relation_list.Count > 0)
                {
                    FDictionary dic = new FDictionary();
                    foreach (FriendsInfo info in friendsDic.Values)
                    {
                        dic[info.configId] = info;
                    }
                    if (!allFriendDic.ContainsKey(msg.relation_list[0].type))
                    {
                        allFriendDic[msg.relation_list[0].type] = dic;
                    }
                }
            }
        }
        if (msg.relation_list.Count > 0 && msg.relation_list[0].type == 4)
        {
            if (OnEnemyDicUpdata != null)
            {
                OnEnemyDicUpdata();
            }
        }
        if (OnFriendsDicUpdata != null)
        {
            OnFriendsDicUpdata();
        }
    }