Exemple #1
0
    private void UpdateInviteData()
    {
        open.GetInvitableFriends((res) =>
        {
            Dictionary <string, string> invitedFriends = LocalDatasManager.invitedFriends;
            if (invitedFriends == null)
            {
                invitedFriends = new Dictionary <string, string>();
            }

            model.userData.invitableList = new List <InvitableFriendsData>();

            for (int i = 0; i < res.Length; i++)
            {
                InvitableFriendsData data = res[i];
                if (!invitedFriends.ContainsKey(data.name))
                {
                    model.userData.invitableList.Add(data);
                }
            }
        });

        GameMainManager.instance.netManager.GetRecallableFriends((ret, res) =>
        {
            if (res.isOK)
            {
                if (res.data.recall_friend_rewards != null)
                {
                    model.userData.recallableList = new List <ShareData.RecallableFriendData>(res.data.recall_friend_rewards);
                }
            }
        });
    }
Exemple #2
0
    public void Refresh()
    {
        invitedFriends = LocalDatasManager.invitedFriends;
        if (invitedFriends == null)
        {
            invitedFriends = new Dictionary <string, string>();
        }

        GameMainManager.instance.netManager.GetInviteProgress((ret, res) =>
        {
            if (res.isOK)
            {
                if (res.data.limit > 0)
                {
                    SetProgress(res.data.times, res.data.limit);
                }
                inviteEnergyText.text = res.data.is_first ? "50" : "20";
            }
        });

        GameMainManager.instance.open.GetInvitableFriends((res) => {
            invitableList = new List <InviteItemData>();

            /* //假数据
             * res = new InvitableFriendsData[10];
             * for(int i = 0;i<res.Length;i++)
             * {
             *   res[i] = new InvitableFriendsData();
             *   res[i].name = "游客7" + i.ToString();
             *   res[i].id = i.ToString();
             * }*/
            GameMainManager.instance.model.userData.invitableList = new List <InvitableFriendsData>();
            for (int i = 0; i < res.Length; i++)
            {
                InvitableFriendsData data = res[i];
                if (!invitedFriends.ContainsKey(data.name))
                {
                    InviteItemData itemData = new InviteItemData();
                    itemData.id             = data.id;
                    itemData.name           = data.name;
                    itemData.isSelected     = allSelectToggle.isOn;

                    invitableList.Add(itemData);
                    GameMainManager.instance.model.userData.invitableList.Add(data);
                }
            }

            scrollView.SetData(invitableList);
            if (sliderText.text == "")
            {
                SetProgress(0, invitableList.Count);
            }
            GameMainManager.instance.netManager.SetInviteProgress(invitableList.Count, (ret, rs) => {});
            inviteAllBtn.interactable = invitableList.Count > 0;
        });
    }