|
@@ -1,6 +1,7 @@
|
|
|
using UnityEngine;
|
|
|
using FairyGUI;
|
|
|
using UI.Friend;
|
|
|
+using System.Collections.Generic;
|
|
|
|
|
|
namespace GFGGame
|
|
|
{
|
|
@@ -8,7 +9,7 @@ namespace GFGGame
|
|
|
{
|
|
|
private UI_FriendAddUI _ui;
|
|
|
|
|
|
-
|
|
|
+ private List<int> _searchDatas = new List<int>();
|
|
|
public override void Dispose()
|
|
|
{
|
|
|
if (_ui != null)
|
|
@@ -30,17 +31,20 @@ namespace GFGGame
|
|
|
viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
|
|
|
|
|
|
_ui.m_listSearch.itemRenderer = RenderListSearchItem;
|
|
|
- _ui.m_listApply.itemRenderer = RenderListApplyItem;
|
|
|
_ui.m_btnSearch.onClick.Add(OnBtnSearchClick);
|
|
|
+ _ui.m_btnClear.onClick.Add(OnBtnClearClick);
|
|
|
_ui.m_btnRefresh.onClick.Add(OnBtnRefreshClick);
|
|
|
|
|
|
+ _ui.m_listApply.itemRenderer = RenderListApplyItem;
|
|
|
+ _ui.m_btnAgreeAll.onClick.Add(OnBtnAgreeAllClick);
|
|
|
+ _ui.m_btnRefuseAll.onClick.Add(OnBtnRefuseAllClick);
|
|
|
}
|
|
|
|
|
|
protected override void OnInit()
|
|
|
{
|
|
|
base.OnInit();
|
|
|
|
|
|
- _ui.m_c1.onChanged.Add(OnCtrlChange);
|
|
|
+ // _ui.m_c1.onChanged.Add(OnCtrlChange);
|
|
|
|
|
|
}
|
|
|
protected override void AddEventListener()
|
|
@@ -51,9 +55,11 @@ namespace GFGGame
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
- _ui.m_c1.selectedIndex = 1;
|
|
|
-
|
|
|
- OnCtrlChange();
|
|
|
+ _ui.m_c1.selectedIndex = 0;
|
|
|
+ _ui.m_txtSearch.text = "";
|
|
|
+ _ui.m_btnClear.visible = false;
|
|
|
+ // OnCtrlChange();
|
|
|
+ OnBtnRefreshClick();
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
@@ -66,41 +72,67 @@ namespace GFGGame
|
|
|
|
|
|
}
|
|
|
|
|
|
- private void OnCtrlChange()
|
|
|
+ /**************************************************好友搜索***********************************************/
|
|
|
+
|
|
|
+ private void RenderListSearchItem(int index, GObject obj)
|
|
|
+ {
|
|
|
+ UI_ListSearchItem item = UI_ListSearchItem.Proxy(obj);
|
|
|
+ if (item.m_btnAdd.data == null)
|
|
|
+ {
|
|
|
+ item.m_btnAdd.onClick.Add(OnBtnAddClick);
|
|
|
+ }
|
|
|
+ UI_ListSearchItem.ProxyEnd();
|
|
|
+ }
|
|
|
+
|
|
|
+ //添加好友
|
|
|
+ private void OnBtnAddClick(EventContext context)
|
|
|
{
|
|
|
- // if (_ui.m_c1.selectedIndex == 0)
|
|
|
- // {
|
|
|
- // UpdateListSearch();
|
|
|
- // }
|
|
|
- // else if (_ui.m_c1.selectedIndex == 1)
|
|
|
- // {
|
|
|
- // _ui.m_listApply.numItems = 0;
|
|
|
- // }
|
|
|
+ GObject obj = context.data as GObject;
|
|
|
}
|
|
|
|
|
|
- private void UpdateListSearch()
|
|
|
+ //搜索好友
|
|
|
+ private void OnBtnSearchClick()
|
|
|
{
|
|
|
- if (string.IsNullOrEmpty(_ui.m_txtSearch.text))
|
|
|
+ if (_ui.m_txtSearch.text.Length < 2)
|
|
|
{
|
|
|
- _ui.m_listSearch.numItems = 0;
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("请输入至少两个字符");
|
|
|
+ return;
|
|
|
}
|
|
|
- else
|
|
|
+ bool result = true;
|
|
|
+ if (result)
|
|
|
{
|
|
|
-
|
|
|
+ _ui.m_txtTips.text = "搜索结果";
|
|
|
+ _ui.m_btnClear.visible = true;
|
|
|
+ _searchDatas = null;
|
|
|
+ _ui.m_listSearch.numItems = 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void RenderListSearchItem(int index, GObject obj)
|
|
|
+ //清空搜索
|
|
|
+ private void OnBtnClearClick()
|
|
|
{
|
|
|
- UI_ListSearchItem item = UI_ListSearchItem.Proxy(obj);
|
|
|
- if (item.m_btnAdd.data == null)
|
|
|
+ _ui.m_txtSearch.text = "";
|
|
|
+ _ui.m_btnClear.visible = false;
|
|
|
+ OnBtnRefreshClick();
|
|
|
+ }
|
|
|
+
|
|
|
+ //刷新好友列表
|
|
|
+ private void OnBtnRefreshClick()
|
|
|
+ {
|
|
|
+ _ui.m_txtTips.text = "推荐好友";
|
|
|
+ bool result = true;
|
|
|
+ if (result)
|
|
|
{
|
|
|
- item.m_btnAdd.onClick.Add(OnBtnAddClick);
|
|
|
+ _searchDatas = null;
|
|
|
+ _ui.m_listSearch.numItems = 0;
|
|
|
}
|
|
|
- UI_ListSearchItem.ProxyEnd();
|
|
|
}
|
|
|
+
|
|
|
+ /**************************************************好友申请***********************************************/
|
|
|
+
|
|
|
private void RenderListApplyItem(int index, GObject obj)
|
|
|
{
|
|
|
+ int data = _searchDatas[index];
|
|
|
UI_ListApplyItem item = UI_ListApplyItem.Proxy();
|
|
|
if (item.m_btnAgree.data == null)
|
|
|
{
|
|
@@ -112,35 +144,32 @@ namespace GFGGame
|
|
|
}
|
|
|
UI_ListApplyItem.ProxyEnd();
|
|
|
}
|
|
|
-
|
|
|
- //添加好友
|
|
|
- private void OnBtnAddClick()
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
//通过好友申请
|
|
|
- private void OnBtnAgreeClick()
|
|
|
+ private void OnBtnAgreeClick(EventContext context)
|
|
|
{
|
|
|
-
|
|
|
+ GObject obj = context.data as GObject;
|
|
|
}
|
|
|
|
|
|
//拒绝好友申请
|
|
|
- private void OnBtnRefuseClick()
|
|
|
+ private void OnBtnRefuseClick(EventContext context)
|
|
|
{
|
|
|
+ GObject obj = context.data as GObject;
|
|
|
|
|
|
}
|
|
|
|
|
|
- //搜过好友
|
|
|
- private void OnBtnSearchClick()
|
|
|
+ //一键通过好友申请
|
|
|
+ private void OnBtnAgreeAllClick()
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
- //刷新好友列表
|
|
|
- private void OnBtnRefreshClick()
|
|
|
+ //一键拒绝好友申请
|
|
|
+ private void OnBtnRefuseAllClick()
|
|
|
{
|
|
|
+ AlertUI.Show("是否拒绝所有好友申请?").SetLeftButton(true).SetRightButton(true, "确定", (object data) =>
|
|
|
+ {
|
|
|
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
}
|