void OnClick(GameObject sender) { Tools.PlayAudio(Constants.Audio.Audio_LobbyClickButton); DebugConsole.Log(sender.name); int btnIndex = GetBtn(sender.name); if (btnIndex < 0) { DebugConsole.Log("Cant find button:" + sender.name); return; } switch ((DialogBtn)btnIndex) { case DialogBtn.Close: { GameObject btnObj = GameObject.Find(DialogName); if (null == btnObj) { DebugConsole.Log("null"); } else { DebugConsole.Log("DoHide"); DoHide(btnObj); } } break; case DialogBtn.SearchOff: case DialogBtn.FriendseOff: case DialogBtn.RequestOff: break; case DialogBtn.FriendsOn: { Lobby.getInstance().CurrentSummaryList.Data.Clear(); m_activePage = 0; Reception recp = GameObject.Find("Reception").GetComponent <Reception>(); recp.GetFriends(UpdateFriendsUI); } break; case DialogBtn.SearchOn: { Lobby.getInstance().CurrentSummaryList.Data.Clear(); m_activePage = 1; UpdateSearchUI(); UpdateUI(); } break; case DialogBtn.RequestOn: { Lobby.getInstance().CurrentSummaryList.Data.Clear(); m_activePage = 2; Reception recp = GameObject.Find("Reception").GetComponent <Reception>(); recp.GetFriendRequests(UpdateRequestUI); } break; case DialogBtn.SearchFriend: { Reception recp = GameObject.Find("Reception").GetComponent <Reception>(); GameObject goInput = GameObject.Find("InputSearchFriendCode"); string uIdStr = goInput.transform.Find("Text").GetComponent <Text>().text; DebugConsole.Log("Search:" + uIdStr); long uId = Tools.StringToInt64(uIdStr); // 先清理结果 Lobby.getInstance().CurrentSummaryList.Data.Clear(); if (uId > 0) { recp.GetFriendSummaryByUId(uId, UpdateSearchUI); } else { UpdateSearchUI(); } } break; case DialogBtn.FriendLastPage: { if (Lobby.getInstance().CurrentFriendPage == 0) { Lobby.getInstance().CurrentFriendPage = Lobby.getInstance().FriendPageCount - 1; } else { Lobby.getInstance().CurrentFriendPage--; } Reception recp = GameObject.Find("Reception").GetComponent <Reception>(); recp.GetFriendSummary(UpdateFriendsUI); } break; case DialogBtn.RequestLastPage: { if (Lobby.getInstance().CurrentFriendPage == 0) { Lobby.getInstance().CurrentFriendPage = Lobby.getInstance().FriendPageCount - 1; } else { Lobby.getInstance().CurrentFriendPage--; } Reception recp = GameObject.Find("Reception").GetComponent <Reception>(); recp.GetFriendSummary(UpdateRequestUI); recp.HearBeat(); } break; case DialogBtn.FriendNextPage: { Lobby.getInstance().CurrentFriendPage++; if (Lobby.getInstance().CurrentFriendPage == Lobby.getInstance().FriendPageCount) { Lobby.getInstance().CurrentFriendPage = 0; } Reception recp = GameObject.Find("Reception").GetComponent <Reception>(); recp.GetFriendSummary(UpdateFriendsUI); } break; case DialogBtn.RequestNextPage: { Lobby.getInstance().CurrentFriendPage++; if (Lobby.getInstance().CurrentFriendPage == Lobby.getInstance().FriendPageCount) { Lobby.getInstance().CurrentFriendPage = 0; } Reception recp = GameObject.Find("Reception").GetComponent <Reception>(); recp.GetFriendSummary(UpdateRequestUI); } break; case DialogBtn.ViewFriend1: case DialogBtn.ViewFriend2: case DialogBtn.ViewFriend3: case DialogBtn.ViewFriend4: case DialogBtn.ViewFriend5: case DialogBtn.ViewFriend6: { Reception recp = GameObject.Find("Reception").GetComponent <Reception>(); int idx = Lobby.getInstance().CurrentFriendPage *Constants.PageItemCount + btnIndex - (int)DialogBtn.ViewFriend1; long uId = Lobby.getInstance().FriendIDArray.Data[idx]; recp.GetProfile(uId, ShowPersonalInfoDlg); //ShowPersonalInfoDlg } break; case DialogBtn.IngorFriend1: case DialogBtn.IngorFriend2: case DialogBtn.IngorFriend3: case DialogBtn.IngorFriend4: case DialogBtn.IngorFriend5: case DialogBtn.IngorFriend6: { int idx = Lobby.getInstance().CurrentFriendPage *Constants.PageItemCount + btnIndex - (int)DialogBtn.IngorFriend1; m_opId = Lobby.getInstance().FriendIDArray.Data[idx]; DialogBase.Show("REQUEST IGNORE", "Are you sure to ingore the request?", IngoreFriend); } break; case DialogBtn.AcceptFriend1: case DialogBtn.AcceptFriend2: case DialogBtn.AcceptFriend3: case DialogBtn.AcceptFriend4: case DialogBtn.AcceptFriend5: case DialogBtn.AcceptFriend6: { int idx = Lobby.getInstance().CurrentFriendPage *Constants.PageItemCount + btnIndex - (int)DialogBtn.AcceptFriend1; m_opId = Lobby.getInstance().FriendIDArray.Data[idx]; DialogBase.Show("REQUEST ACCEPT", "Are you sure to accept the request?", AcceptFriend); } break; case DialogBtn.ViewSearchResult: { Reception recp = GameObject.Find("Reception").GetComponent <Reception>(); recp.GetProfile(Lobby.getInstance().CurrentSummaryList.Data[0].UserId, ShowPersonalInfoDlg); } break; default: break; } }