Ejemplo n.º 1
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;
        });
    }
Ejemplo n.º 2
0
    private void UpdateMyFriendsData(FriendData[] friendDatas)
    {
        //receiveCountText.text = string.Format("今日领取次数:{0}/{1}",GameMainManager.instance.model.userData.rec)

        List <FriendItemData> friendItems = new List <FriendItemData>();

        friendItems.Add(new FriendItemData(0, null));

        if (friendDatas != null)
        {
            foreach (FriendData fd in friendDatas)
            {
                friendItems.Add(new FriendItemData(1, fd));
            }

            bool tag = false;
            foreach (FriendData fd in friendDatas)
            {
                if (fd.sendStatus == 0 || fd.receiveStatus == 1)
                {
                    tag = true;
                    break;
                }
            }
            receiveBtn.interactable = tag;
        }
        myFriendsScrollView.SetData(friendItems);
    }
Ejemplo n.º 3
0
 private void SendSelectTargetData(List <SelectPlayerData> list)
 {
     if (list != null && list.Count > 0)
     {
         foreach (SelectPlayerData data in list)
         {
             data.isRandomUser = data.uid == randomTarget.uid ? true : false;
             data.isSelected   = data.uid == selectedTarget.uid ? true : false;
         }
         scrollView.SetData(list);
     }
     else
     {
         scrollView.SetData(new List <SelectPlayerData>());
     }
 }
Ejemplo n.º 4
0
 protected override void StartShowWindow(object[] data)
 {
     wantedNumText.text = GameMainManager.instance.model.userData.wantedCount.ToString();
     GameMainManager.instance.netManager.Enemy((ret, res) =>
     {
         badGuys = res.data.enemies;
         scrollView.SetData(badGuys);
     });
 }
Ejemplo n.º 5
0
    protected override void StartShowWindow(object[] data)
    {
        GameMainManager.instance.netManager.GetRecallableFriends((ret, res) =>
        {
            progress.value = (float)res.data.invite_process / res.data.invite_reward_num_limit;
            progressText.text = res.data.invite_process.ToString() + "/" + res.data.invite_reward_num_limit.ToString();
            rewards = res.data.invite_friend_rewards;
            scrollView.SetData(rewards);

        });
    }
Ejemplo n.º 6
0
 public void OnChangeMailToggle(bool value)
 {
     if (value)
     {
         GameMainManager.instance.audioManager.PlaySound(AudioNameEnum.button_click);
         mailScrollView.SetData(mails);
         ShowPanel(mailPanel);
     }
     else
     {
         HidePanel(mailPanel);
     }
 }
Ejemplo n.º 7
0
 public void Refresh()
 {
     GameMainManager.instance.netManager.GetRecallableFriends((ret, res) =>
     {
         /*
          * res.data.recall_friend_rewards = new ShareData.RecallableFriendData[10];
          * for(int i = 0;i< res.data.recall_friend_rewards.Length;i++)
          * {
          *  res.data.recall_friend_rewards[i] = new ShareData.RecallableFriendData();
          *  res.data.recall_friend_rewards[i].name = "游客"+i.ToString();
          *  res.data.recall_friend_rewards[i].uid = 123 + i;
          *  res.data.recall_friend_rewards[i].head_img = "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1018364764,1223529536&fm=27&gp=0.jpg";
          * }*/
         if (res.isOK)
         {
             if (res.data.recall_friend_rewards != null)
             {
                 GameMainManager.instance.model.userData.recallableList = new List <ShareData.RecallableFriendData>(res.data.recall_friend_rewards);
                 recallableList = new List <RecallFriendData>();
                 foreach (ShareData.RecallableFriendData friend in res.data.recall_friend_rewards)
                 {
                     RecallFriendData data = new RecallFriendData();
                     data.data             = friend;
                     data.isSelected       = true;
                     recallableList.Add(data);
                 }
                 scrollView.SetData(recallableList);
             }
             else
             {
                 GameMainManager.instance.model.userData.recallableList = new List <ShareData.RecallableFriendData>();
             }
         }
         else
         {
             Alert.Show(res.errmsg);
         }
     });
 }
Ejemplo n.º 8
0
    protected override void StartShowWindow(object[] data)
    {
        GameMainManager.instance.netManager.Message((ret, res) =>
        {
            if (res.isOK)
            {
                if (res.data.user_mail != null)
                {
                    mails = res.data.user_mail;
                    for (int i = 0; i < mails.Length; i++)
                    {
                        mails[i].index = i;
                    }
                }

                if (res.data.messages != null)
                {
                    List <MessageResponseData> list = new List <MessageResponseData>();
                    messages = res.data.messages;
                    for (int i = 0; i < messages.Length; i++)
                    {
                        if (messages[i].action == 1 || messages[i].action == 2 || messages[i].action == 5 || messages[i].action == 6)
                        {
                            list.Add(messages[i]);
                        }
                    }
                    messages = list.ToArray();
                }
                messageScrollView.SetData(messages);
            }
        });



        messageToggle.isOn = true;
        mailToggle.enabled = false;
        mailToggle.enabled = true;
    }
Ejemplo n.º 9
0
 private void UpdateData()
 {
     getRewardBtn.interactable = dailyTaskData.extra_reward.status == 1 ? true : false;
     scrollView.SetData(dailyTaskData.tasks);
 }
Ejemplo n.º 10
0
 private void UpdateNotAgreeFriendsData(FriendData[] friendDatas)
 {
     notAgreeScrollView.SetData(friendDatas);
 }