Exemplo n.º 1
0
 public void Init(FriendInfo info, int rank)
 {
     curInfo = info;
     if (rank <= 3)
     {
         if (rank == 0)
         {
             rankLb.gameObject.SetActive(false);
             rankIcon.gameObject.SetActive(false);
         }
         else
         {
             rankLb.gameObject.SetActive(false);
             rankIcon.gameObject.SetActive(true);
             rankIcon.sprite = BundleManager.Instance.GetSprite("common/normal_jiangbei_" + rank);
         }
     }
     else
     {
         rankLb.gameObject.SetActive(true);
         rankIcon.gameObject.SetActive(false);
         rankLb.text = rank.ToString();
     }
     if (gameObject.activeInHierarchy)
     {
         StartCoroutine(MiscUtils.DownloadImage(info.photo, spr =>
         {
             headIcon.sprite = spr;
         }));
     }
     nameLb.text    = info.nickname;
     sixIcon.sprite = BundleManager.Instance.GetSprite("friend/" + (info.gender == 0 ? "haoyou_pic_nan" : "haoyou_pic_nv"));
     yinbiLb.text   = info.sliver.ToString();
     if (info.isOnline == 0)
     {
         stateLb.text  = "[离线]";
         stateLb.color = Color.red;
     }
     else
     {
         stateLb.text  = "[在线]";
         stateLb.color = Color.green;
     }
     UGUIEventListener.Get(giveBtn).onClick = delegate
     {
         SocialNode.GiveCall(info);
     };
     UGUIEventListener.Get(chatBtn).onClick = delegate
     {
         SocialNode.ChatCall(info);
     };
     UGUIEventListener.Get(headBtn).onClick = delegate
     {
         SocialNode.HeadCall(info, true);
     };
 }
Exemplo n.º 2
0
 public void Inits(MessagePanel.MessagePanelInfo info, CallBack <FriendInfo> click)
 {
     this.info = info;
     if (info.messageType == 0)
     {//玩家
         if (gameObject.activeInHierarchy)
         {
             StartCoroutine(MiscUtils.DownloadImage(info.headIcon, spr =>
             {
                 headIcon.sprite = spr;
             }));
         }
         RefreshNowMessage(info.type, info.text, info.timer);
         nameLb.text    = info.name;
         sixIcon.sprite = BundleManager.Instance.GetSprite(info.six == 0 ? "friend/haoyou_pic_nan" : "friend/haoyou_pic_nv");
         sixIcon.SetNativeSize();
         btn.onClick.AddListener(() =>
                                 click(new FriendInfo()
         {
             photo    = info.headIcon,
             nickname = info.name,
             userId   = info.id,
             gender   = info.six,
         }));
     }
     else
     {//系统
         UGUIEventListener.Get(refuseBtn).onClick = delegate
         {
             SocketClient.Instance.AddSendMessageQueue(new C2GMessage()
             {
                 replyFriendReq = new ReplyFriendReq()
                 {
                     userId = info.id,
                     reply  = -1
                 },
                 msgid = MessageId.C2G_ReplyFriendReq
             });
             Destroy(gameObject);
         };
         UGUIEventListener.Get(agreeBtn).onClick = delegate
         {
             SocketClient.Instance.AddSendMessageQueue(new C2GMessage()
             {
                 replyFriendReq = new ReplyFriendReq()
                 {
                     userId = info.id,
                     reply  = 1
                 },
                 msgid = MessageId.C2G_ReplyFriendReq
             });
             Destroy(gameObject);
         };
         textLb.text = info.name + "[" + info.id + "]" + "请求加您为好友";
     }
 }
Exemplo n.º 3
0
 public void Inits(CardResultShowNode.YuepaiLogPlayerInfo info)//是否赢最多
 {
     winObj.SetActive(info.isMax);
     StartCoroutine(MiscUtils.DownloadImage(info.headIcon, spr =>
     {
         headIcon.sprite  = spr;
         info.headIconSpr = spr;
     }));
     nameLb.text      = info.nickname;
     allResultLb.text = info.allResult > 0 ? "+" + info.allResult : info.allResult.ToString();
 }
Exemplo n.º 4
0
 /// <summary>
 /// 成绩
 /// </summary>
 public void MedalFinish(net_protocol.MedalResp resp)
 {
     haveReward.SetActive(true);
     noHaveReward.SetActive(false);
     reward.text = resp.reward[0].name;
     SetResult(resp.rank, resp.kind, resp.matcherName, resp.dieNum, resp.time);
     StartCoroutine(MiscUtils.DownloadImage(resp.reward[0].icon, (spr) => { if (spr != null)
                                                                            {
                                                                                rewardIcon.sprite = spr;
                                                                            }
                                            }));
 }
Exemplo n.º 5
0
 /// <summary>
 /// 加载头像图片
 /// </summary>
 void LoadIcon()
 {
     if (aniList[0].userIcon != "")
     {
         Image headIcon = UIUtils.FindHideChildGameObject <Image>(aniParentObj, "headIcon");
         if (headIcon)
         {
             StartCoroutine(MiscUtils.DownloadImage(aniList[0].userIcon, spr =>
             {
                 headIcon.sprite = spr;
             }));
         }
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// 初始化
 /// </summary>
 public void Init(RankData data)
 {
     _data = data;
     SetValue();
     vip.SetActive(_data.vip > 0);
     getNum.text       = RankNode.KeepGoldNum(_data.getNum);
     playNameOrId.text = string.Format(_data.nickName + " ID:" + _data.userId);
     UGUIEventListener.Get(playIcon.gameObject).onClick = (g) => { _node.playinfoPanel.OpenPanel(_data); };
     StartCoroutine(MiscUtils.DownloadImage(_data.icon, spr => { if (spr != null)
                                                                 {
                                                                     playIcon.sprite = _data.iconSprite = spr;
                                                                 }
                                            }));
 }
Exemplo n.º 7
0
 public void Inits(FriendInfo info)
 {
     curInfo = info;
     StartCoroutine(MiscUtils.DownloadImage(info.photo, spr =>
     {
         headIcon.sprite = spr;
     }));
     nameLb.text     = info.nickname;
     timer.allLength = 10;
     timer.isOnce    = true;
     timer.endAction = () => Close(false);
     timer.StartTime();
     UGUIEventListener.Get(agreeBtn).onClick  = delegate { AgreeAddFriend(true); };
     UGUIEventListener.Get(refuseBtn).onClick = delegate { AgreeAddFriend(false); };
 }
Exemplo n.º 8
0
 public void SetValue(List <Reward> data)
 {
     _data           = data;
     rewardName.text = data[0].name;
     if (_data[0].icon != "")
     {
         StartCoroutine(MiscUtils.DownloadImage(_data[0].icon, spr => { if (spr != null)
                                                                        {
                                                                            rewardIcon.sprite = spr;
                                                                        }
                                                }));
     }
     else
     {
         Debug.Log("奖励图片地址为空:" + data[0].name);
     }
 }
Exemplo n.º 9
0
 public void Init(MatcherRewardlog reward)
 {
     hintPanel.SetActive(false);
     matchName.text = reward.matcherName;
     hintText.text  = reward.rewardDesc;
     UGUIEventListener.Get(hintBtn).onClick = delegate { StartCoroutine(OpenHint()); };
     StartCoroutine(MiscUtils.DownloadImage(reward.rewardIcon, spr => {
         if (spr != null)
         {
             icon.sprite = spr;
             rewardText.gameObject.SetActive(false);
         }
         else
         {
             rewardText.text = reward.rewardName;
         }
     }));
 }
Exemplo n.º 10
0
    public void Init(MatcherInfo data)
    {
        _data      = data;
        title.text = _data.name;

        logIcon.sprite   = BundleManager.Instance.GetSprite("Common/normal_icon_" + _data.type);
        applyIcon.sprite = BundleManager.Instance.GetSprite("Common/normal_log_" + _data.costType);
        applyIcon.SetNativeSize();

        hintText.text    = _data.timeType == 1 ? "今晚" + _data.beginTime + "开赛" : "每" + _data.beginTime + "分一场";
        beginText.text   = MatchPage.GetTimerText(_data.distance, 3);
        joinNumText.text = _data.joinUser.ToString();

        applyNum.text = _data.cost.ToString();
        applyNum.gameObject.SetActive(_data.cost > 0);
        applyFree.gameObject.SetActive(_data.cost == -1);

        if (_data.distance > 0)
        {
            StartCoroutine(UpMyTime());
        }
        if (_data.icon != "")
        {
            StartCoroutine(MiscUtils.DownloadImage(_data.icon, spr => { if (spr != null)
                                                                        {
                                                                            awardIcon.sprite = spr;
                                                                        }
                                                   }));
        }
        else
        {
            Debug.Log("图片地址为空:" + _data.name);
        }
        matchBtn.onClick.AddListener(() =>
        {
            MatchModel.Instance.CurData = _data;
            if (awardIcon.sprite != null)
            {
                MatchModel.Instance.rewardIcon = awardIcon.sprite;
            }
            NodeManager.OpenNode <MatchApplyNode>("match");
            AudioManager.Instance.PlaySound(AudioManager.AudioSoundType.BtnClick);
        });
    }
Exemplo n.º 11
0
 public void Init(BasePlayerInfo info, bool isFriend)
 {
     curInfo = info;
     StartCoroutine(MiscUtils.DownloadImage(info.icon, spr =>
     {
         headIcon.sprite = spr;
     }));
     idLb.text      = info.uid;
     nameLb.text    = info.userNickname;
     sixIcon.sprite = BundleManager.Instance.GetSprite(info.six == Six.boy ? "friend/haoyou_pic_nan" : "friend/haoyou_pic_nv");
     sixIcon.SetNativeSize();
     yinbiLb.text = info.money.ToString();
     vipObj.SetActive(info.vip > 0);
     try
     {//没到最大等级
         JsonData nextLvJson = UserInfoModel.GetLvJsonData(UserInfoModel.userInfo.level + 1);
         long     allExp     = long.Parse(nextLvJson["exp"].ToString());
         SetExpSlider(false, allExp);
     }
     catch
     {//到了最大等级
         SetExpSlider(true, 0);
     }
     if (isFriend)
     {
         delBtn.SetActive(true);
         chatBtn.SetActive(true);
         jubaoBtn.SetActive(false);
         addFriendBtn.gameObject.SetActive(false);
         UGUIEventListener.Get(delBtn).onClick  = delegate { Del(); };
         UGUIEventListener.Get(chatBtn).onClick = delegate { Chat(); };
     }
     else
     {
         SetBtnState(info.relation);
         delBtn.SetActive(false);
         chatBtn.SetActive(false);
         jubaoBtn.SetActive(true);
         addFriendBtn.gameObject.SetActive(true);
         UGUIEventListener.Get(jubaoBtn).onClick = delegate { Jubao(); };
         UGUIEventListener.Get(addFriendBtn.gameObject).onClick = delegate { AddFriend(); };
     }
 }
Exemplo n.º 12
0
    public void Init(FriendInfo info)
    {
        curInfo = info;
        if (gameObject.activeInHierarchy)
        {
            StartCoroutine(MiscUtils.DownloadImage(info.photo, spr =>
            {
                headIcon.sprite = spr;
            }));
        }
        nameLb.text    = info.nickname;
        sixIcon.sprite = BundleManager.Instance.GetSprite("friend/" + (info.gender == 0 ? "haoyou_pic_nan" : "haoyou_pic_nv"));
        yinbiLb.text   = info.sliver.ToString();

        UGUIEventListener.Get(headIcon.gameObject).onClick = delegate
        {
            SocialNode.HeadCall(info, false);
        };
    }
Exemplo n.º 13
0
    void SetRolrInfo(PlayerBaseInfo info)
    {
        curInfo = info;
        ReqIsFriend(info.userId);
        StartCoroutine(MiscUtils.DownloadImage(info.photo, spr =>
        {
            headIcon.sprite = spr;
        }));

        idLb.text    = info.userId.ToString();
        nameLb.text  = info.nickname;
        yinbiLb.text = info.silver.ToString();
        posLb.text   = info.location;
        vipObj.SetActive(info.vip > 0);
        SetSix();
        SetLv();
        SetFightLog();
        SetBtnVisible();
    }
Exemplo n.º 14
0
 /// <summary>
 /// 非比赛场改变状态(机器人/正常)
 /// </summary>
 public void NoMatchChangeState(bool isRest)//是否还原
 {
     if (isRest || !_handCard.isTuoguan || !LandlordsModel.Instance.IsInFight)
     {
         StartCoroutine(MiscUtils.DownloadImage(_handCard.playerInfo.icon, spr =>
         {
             if (!_handCard.isTuoguan)
             {
                 headIcon.sprite = spr;
             }
         }));
     }
     else
     {
         if (LandlordsModel.Instance.IsInFight)
         {
             headIcon.sprite = BundleManager.Instance.GetSprite("nomal_icon_jiqiren", PageManager.Instance.gamecommonBundle);
         }
     }
 }
Exemplo n.º 15
0
 public void InitUserInfo()
 {
     nickName.text       = UserInfoModel.userInfo.nickName;
     goldBarText.text    = UserInfoModel.userInfo.walletGoldBarNum.ToString();
     roomCardText.text   = UserInfoModel.userInfo.roomCardNum.ToString();
     silverCoinText.text = UserInfoModel.userInfo.walletAgNum.ToString();
     vip.gameObject.SetActive(UserInfoModel.userInfo.vipCard > 0);
     if (UserInfoModel.userInfo.headIconSprite == null)
     {
         StartCoroutine(MiscUtils.DownloadImage(UserInfoModel.userInfo.headIcon, spr =>
         {
             UserInfoModel.userInfo.headIconSprite = spr;
             headIcon.sprite = UserInfoModel.userInfo.headIconSprite;
         }));
     }
     else
     {
         headIcon.sprite = UserInfoModel.userInfo.headIconSprite;
     }
 }
Exemplo n.º 16
0
 void LoadFriendItem(FriendInfo info)
 {
     input.text = string.Empty;
     itemObj.SetActive(true);
     StartCoroutine(MiscUtils.DownloadImage(info.photo, (spr) =>
     {
         headIcon.sprite = spr;
     }));
     nameLb.text = info.nickname;
     SetBtnState(info.relation);
     UGUIEventListener.Get(addBtn.gameObject).onClick = delegate
     {
         if (!addBtn.interactable)
         {
             return;
         }
         SocialModel.Instance.AddFriend(info.userId);
         SetBtnState(1);
     };
 }
Exemplo n.º 17
0
 void OnEnable()
 {
     if (info != null && info.messageType == 0)
     {
         if (headIcon.sprite == null)
         {
             StartCoroutine(MiscUtils.DownloadImage(info.headIcon, spr =>
             {
                 headIcon.sprite = spr;
             }));
         }
         else if (headIcon.sprite.name != "")
         {
             StartCoroutine(MiscUtils.DownloadImage(info.headIcon, spr =>
             {
                 headIcon.sprite = spr;
             }));
         }
     }
 }
Exemplo n.º 18
0
 void OnEnable()
 {
     if (curInfo != null)
     {
         if (headIcon.sprite == null)
         {
             StartCoroutine(MiscUtils.DownloadImage(curInfo.photo, spr =>
             {
                 headIcon.sprite = spr;
             }));
         }
         else if (headIcon.sprite.name != "")
         {
             StartCoroutine(MiscUtils.DownloadImage(curInfo.photo, spr =>
             {
                 headIcon.sprite = spr;
             }));
         }
     }
 }
Exemplo n.º 19
0
    public Text curResultLb; //这次的成绩

    public void Init(DdzJSPlayerInfo info)
    {
        StartCoroutine(MiscUtils.DownloadImage(info.photo, spr =>
        {
            headIcon.sprite = spr;
        }));
        if (identyIcon)
        {
            if (info.isDz)
            {
                identyIcon.sprite = BundleManager.Instance.GetSprite("doudizhu_icon_dizhu2", LandlordsPage.Instance.GetSpriteAB());
            }
            else
            {
                identyIcon.sprite = BundleManager.Instance.GetSprite("doudizhu_icon_nongmin", LandlordsPage.Instance.GetSpriteAB());
            }
        }
        if (info.userId == UserInfoModel.userInfo.userId)
        {
            nameLb.color = new Color(248 / 255f, 228 / 255f, 178 / 255f);
        }
        else
        {
            nameLb.color = new Color(193 / 255f, 95 / 255f, 36 / 255f);
        }
        nameLb.text      = info.nickname.ToString();
        AllresultLb.text = info.totalIncome > 0 ? "+" + info.totalIncome : info.totalIncome.ToString();
        curResultLb.text = info.income > 0 ? "+" + info.income : info.income.ToString();
        if (isMe_name)
        {
            isMe_name.SetActive(info.userId == UserInfoModel.userInfo.userId);
        }
        if (isMe_mask)
        {
            isMe_mask.SetActive(info.userId == UserInfoModel.userInfo.userId);
        }
        if (isWinObj)
        {
            isWinObj.SetActive(info.totalIncome > 0);
        }
    }
Exemplo n.º 20
0
    public void Init(FriendInfo info, CallBack <FriendInfo> addFriendCall)
    {
        StartCoroutine(MiscUtils.DownloadImage(info.photo, spr =>
        {
            headIcon.sprite = spr;
        }));

        nameLb.text     = info.nickname;
        distanceLb.text = info.distance + "米以内";
        SetBtnState(info.relation);
        UGUIEventListener.Get(addFriendBtn.gameObject).onClick = delegate
        {
            if (!addFriendBtn.interactable)
            {
                return;
            }
            SetBtnState(1);
            addFriendCall(info);
            info.relation = 1;
        };
    }
Exemplo n.º 21
0
    /// <summary>
    /// 模拟服务器推送可能认识的人
    /// </summary>
    public void G2C_PossibleKnow()
    {
        if (friends.Count == 0)
        {
            knowPrefab.SetActive(false);
            return;
        }
        int        index = Random.Range(0, friends.Count);
        FriendInfo info  = friends[index];

        curInfo = info;
        knowPrefab.SetActive(true);
        StartCoroutine(MiscUtils.DownloadImage(info.photo, spr =>
        {
            headIcon.sprite = spr;
        }));
        nameLb.text   = info.nickname;
        commonLb.text = "你和 TA 有 " + info.gthy + " 位共同好友 ";
        SetBtnState(info.relation);
        UGUIEventListener.Get(addFriendBtn.gameObject).onClick = delegate { AddFriend(); };
    }
Exemplo n.º 22
0
 void LoadHeadIcon(List <JiesanPlayerInfo> playerInfos)
 {
     //加载
     for (int i = 0; i < playerInfos.Count; i++)
     {
         GameObject go = Instantiate(prefab, parent);
         go.name = playerInfos[i].userId.ToString();
         if (!playerInfos[i].headIcon)
         {
             StartCoroutine(MiscUtils.DownloadImage(playerInfos[i].headIconUrl, spr =>
             {
                 go.transform.Find("HeadIcon").GetComponent <Image>().sprite = spr;
             }));
         }
         else
         {
             go.transform.Find("HeadIcon").GetComponent <Image>().sprite = playerInfos[i].headIcon;
         }
         SetIsGrey(go.transform.Find("HeadIcon").GetComponent <Image>(), true);
         items.Add(go);
     }
 }
Exemplo n.º 23
0
 public void Inits(ChatInfo info)
 {
     curInfo = info;
     StartCoroutine(MiscUtils.DownloadImage(info.playerBaseInfo.icon, spr =>
     {
         headIcon.sprite = spr;
     }));
     if (info.type == 0)
     {//打字
         daziObj.SetActive(true);
         yuyinObj.SetActive(false);
         daziValue.text   = info.text;
         daziBg.sizeDelta = new Vector2(daziValue.preferredWidth + 50, daziValue.preferredHeight + 50);
         (transform as RectTransform).sizeDelta = new Vector2((transform as RectTransform).sizeDelta.x, daziBg.sizeDelta.y);
     }
     else
     {                                                                                                          //语音
         curYuyinPath = info.text;
         UGUIEventListener.Get(yuyinBtn).onClick = delegate { SocialModel.Instance.PlayRecord(curYuyinPath); }; //播放语音
         daziObj.SetActive(false);
         yuyinObj.SetActive(true);
         timer.text = info.voice_timer + "\"";
     }
 }
Exemplo n.º 24
0
 public void Init(GameUser gu)
 {
     this.userId = gu.uid;
     this.seatNo = gu.pos;
     this.sex    = gu.sex;
     if (MaJangPage.Instance.playerCount < 4)
     {
         this.seatNo            *= 2;
         columnMax               = 15;//2人玩法每行15张牌,起始位置x=-5.8
         outParent.localPosition = new Vector3(-5.8f, 0, 5.15f);
     }
     this.nickName.text    = gu.name.Length > 5 ? gu.name.Substring(0, 4) + "..." : gu.name;
     this.currencyNum.text = gu.coin.ToString();
     readyIcon.SetActive(gu.prepared);
     vipIcon.SetActive(gu.vip);
     currencyIcon.sprite = MaJangPage.Instance.currencySprites[(int)MaJangPage.Instance.roomType - 1];
     isCurrentPlayer     = userId == UserInfoModel.userInfo.userId;
     gameObject.SetActive(true);
     StartCoroutine(MiscUtils.DownloadImage(gu.icon, sprite => { headIcon.sprite = sprite; }));
     if (btnChangeSeat)
     {
         btnChangeSeat.SetActive(true);
     }
 }