Пример #1
0
    public void OnClickBtn(string eventName)
    {
        SoundManager.instance.PlaySound(SoundType.Click);
        friends.interactable    = true;
        FriendList.interactable = true;
        switch (eventName)
        {
        case "close":
        {
            MainMenuController.instance.DestroyScreen(MainMenuScreens.FriendList);
        }
        break;

        case "Friends":
        {
            friends.interactable = false;
            friends.GetComponent <Image>().color    = new Color(1, 1, 1, 0);
            FriendList.GetComponent <Image>().color = new Color(1, 1, 1, 1);
            //    friends.GetComponent<Image>().color.a = 0;
            for (int i = 0; i < container.childCount; i++)
            {
                Destroy(container.GetChild(i).gameObject);
            }
            string requestData = "{\"userId\":\"" + PlayerManager.instance.GetPlayerGameData().userId + "\"}";

            WebServices.instance.SendRequest(RequestType.GetFriendList, requestData, true, OnServerResponseFound);
        }
        break;

        case "FriendList":
        {
            FriendList.interactable = false;
            friends.GetComponent <Image>().color    = new Color(1, 1, 1, 1);
            FriendList.GetComponent <Image>().color = new Color(1, 1, 1, 0);
            for (int i = 0; i < container.childCount; i++)
            {
                Destroy(container.GetChild(i).gameObject);
            }
            string requestData = "{\"userId\":\"" + PlayerManager.instance.GetPlayerGameData().userId + "\"," +
                                 "\"Status\":\"" + "Pending" + "\"}";

            WebServices.instance.SendRequest(RequestType.GetAllFriendRequest, requestData, true, OnServerResponseFound);
        }
        break;

        default:
#if ERROR_LOG
            Debug.LogError("unhdnled eventName found in LobbyUiManager = " + eventName);
#endif
            break;
        }
    }