示例#1
0
        public void friendBtnClick(object sender, EventArgs e)
        {
            if ((sender as Button).Text == "Añadir amigo")
            {
                bool check = _proxy.CreateFriendRequest(Convert.ToInt32((sender as Button).Name), _userID);

                if (check)
                {
                    _form.Hide();
                    Form next = new OtherProfile(Convert.ToInt32((sender as Button).Name));
                    next.ShowDialog();
                    _form.Close();
                }
                else
                {
                    MessageBox.Show("Error al mandar solicitud.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if ((sender as Button).Text == "Eliminar amigo")
            {
                User otherUser = _proxy.GetUserById(Convert.ToInt32((sender as Button).Name));
                if (MessageBox.Show($"¿Seguro que quieres eliminar a {otherUser.firstName}?", "Eliminar amigo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    bool check = _proxy.DeleteFriendship(_userID, otherUser.ID);

                    if (check)
                    {
                        _form.Hide();
                        Form next = new OtherProfile(otherUser.ID);
                        next.ShowDialog();
                        _form.Close();
                    }
                    else
                    {
                        MessageBox.Show("Error al eliminar amigo.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                User otherUser = _proxy.GetUserById(Convert.ToInt32((sender as Button).Name));
                if (MessageBox.Show($"¿Seguro que quieres cancelar la solicitud de amistad a {otherUser.firstName}?", "Cancelar solicitud", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    bool check = _proxy.DeleteFriendshipRequest(otherUser.ID, _userID);

                    if (check)
                    {
                        _form.Hide();
                        Form next = new FriendSearch(_pattern);
                        next.ShowDialog();
                        _form.Close();
                    }
                    else
                    {
                        MessageBox.Show("Error al eliminar solicitud.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
示例#2
0
    protected override void PageSwitchSetting(bool initalize)
    {
        base.PageSwitchSetting(initalize);

        if (m_FriendSearch == null)
        {
            m_FriendSearch = m_CanvasObj.GetComponentInChildren <FriendSearch>();
            m_FriendSearch.SetPositionAjustStatusBar(new Vector2(0, -258));

            //Self UserId
            uint userId = LocalSaveManager.Instance.LoadFuncUserID();
            m_FriendSearch.SelfIDText = UnityUtil.CreateDrawUserID(userId);

            //
            m_FriendSearch.DidSearchFriend = SearchFriend;
        }

        resetSearchUserId();

        MainMenuManager.Instance.currentCategory = MAINMENU_CATEGORY.FRIEND;
    }
示例#3
0
 void OnValueUpdateEventArgs(object obj, ValueUpdateEventArgs v)
 {
     if (m_currRelationList.ToString() == v.key)
     {
         List <RoleRelation> datas = (List <RoleRelation>)v.newValue;
         m_label_labletips.text = "";
         Engine.Utility.Log.LogGroup("ZCX", "update list " + m_currRelationList.ToString() + datas.Count);
         RefreshLeftListUI();
         if (m_currRelationList == GameCmd.RelationType.Relation_Contact)
         {
             if (m_ctor_FriendScrollview != null)
             {
                 // m_FriendUIGridCreatorBase.CreateGrids(datas.Count);
                 List <UIFriendGrid> lstGrid = m_ctor_FriendScrollview.GetGrids <UIFriendGrid>(true);
                 for (int i = 0; i < lstGrid.Count; i++)
                 {
                     if (lstGrid[i].Data.uid == privateChatManager.SilentFrienduid)
                     {
                         OnSelectFriend(lstGrid[i].Data, true);
                         lstGrid[i].SetMaskState(true);
                         break;
                     }
                 }
             }
         }
     }
     else if ("SEARCH" == v.key && m_currRelationList == GameCmd.RelationType.Relation_FriendRequest)
     {
         List <RoleRelation> datas = (List <RoleRelation>)v.newValue;
         if (m_trans_chatroot != null)
         {
             m_trans_chatroot.DestroyChildren();
             for (int i = 0; i < datas.Count; i++)
             {
                 GameObject go = NGUITools.AddChild(m_trans_chatroot.gameObject, m_sprite_bg_searchresults.gameObject);
                 go.transform.localPosition = new Vector3(0, -105 * i, 0);
                 FriendSearch script = go.AddComponent <FriendSearch>();
                 go.SetActive(true);
                 script.SetInfo(datas[i], m_input_Input.value);
             }
         }
     }
     else if ("SortList" == v.key && m_currRelationList == GameCmd.RelationType.Relation_Contact)
     {
         DeActiveFrendItem();
         List <RoleRelation> datas = (List <RoleRelation>)v.newValue;
         if (m_ctor_FriendScrollview != null)
         {
             m_ctor_FriendScrollview.CreateGrids(datas.Count);
             if (privateChatManager.SilentFrienduid != 0)
             {
                 List <UIFriendGrid> lstGrid = m_ctor_FriendScrollview.GetGrids <UIFriendGrid>(true);
                 for (int i = 0; i < lstGrid.Count; i++)
                 {
                     if (lstGrid[i].Data.uid == privateChatManager.SilentFrienduid)
                     {
                         OnSelectFriend(lstGrid[i].Data, true);
                         lstGrid[i].SetMaskState(true);
                         break;
                     }
                 }
             }
         }
     }
     else if ("updateFriendLevel" == v.key)
     {
         if (m_ctor_FriendScrollview != null)
         {
             m_relationMgr.GetRelationListByType(m_currRelationList, out m_lstRoleRelation);
             m_ctor_FriendScrollview.UpdateActiveGridData();
             //                 List<UIFriendGrid> lstGrid = m_ctor_FriendScrollview.GetGrids<UIFriendGrid>(true);
             //                 for (int i = 0; i < lstGrid.Count; i++)
             //                 {
             //                     lstGrid[i].RefreshLevel();
             //                 }
         }
     }
 }