Пример #1
0
 public async void ScrollCellIndex(int idx)
 {
     ButtonEnterManor.onClick.RemoveAllListeners();
     ButtonEnterManor.onClick.AddListener(OnEnterManor);
     curFriendStealInfo = StaticData.playerInfoData.listFriendStealInfo[idx];
     //头像
     imageIcon.sprite  = ChatTool.GetIcon(curFriendStealInfo.headIcon);
     TextNickname.text = curFriendStealInfo.nickname;
     TextLevelNum.text = curFriendStealInfo.level.ToString();
     handTag.gameObject.SetActive(curFriendStealInfo.isSteal);
 }
Пример #2
0
    public async void Show(ChatInfo data, RectTransform tageTra, RectTransform astrictScope)
    {
        if (!_isInitial)
        {
            Initial();
        }
        _currData = data;
        _thisCanvasGroup.alpha = 0;
        if (string.IsNullOrEmpty(_currData._iconUrl))
        {
            _icon.sprite = ChatTool.GetIcon(_currData._iconId);
        }
        else
        {
            _icon.sprite = await ChatTool.GetIcon(_currData._iconUrl);
        }

        _showName.text  = _currData._playName;
        _showGrade.text = StaticData.GetPlayerLevelByExp((int)_currData._experience).ToString();

        //if (await StaticData.IsUserFriend(data._playUid))
        //{
        //    _makeFriendsBtnImage.color = new Color(202f, 202f, 202f);
        //}
        //else
        //{
        //    _makeFriendsBtnImage.color = new Color(255f, 255f, 255f);
        //}

        if (ChatPanelController._Instance == null || (ChatPanelController._Instance._CurrPrivateChatIndex == data._playUid && ChatPanelController._Instance._CurrType == 1))
        {
            //_chatBtnImage.color = new Color(202f, 202f, 202f);
            _chatBtn.enabled = false;
        }
        else
        {
            //_chatBtnImage.color = new Color(255f, 255f, 255f);
            _chatBtn.enabled = true;
        }

        if (StaticData.IsFriendOnline(_currData._playUid))
        {
            _typeText.text         = StaticData.GetMultilingual(120110);
            _typeLabelImage.sprite = await ABManager.GetAssetAsync <Sprite>("lt_tips_zx");
        }
        else
        {
            _typeText.text         = StaticData.GetMultilingual(120111);
            _typeLabelImage.sprite = await ABManager.GetAssetAsync <Sprite>("lt_tips_lx");
        }

        SetPoint(tageTra, astrictScope);
    }
Пример #3
0
    /// <summary>
    /// 生成好友列表中LoopItem后的回调函数
    /// 改变每个LoopItem的参数
    /// </summary>
    /// <param name="idx"></param>
    public async void ScrollCellIndex(int idx)
    {
        Initial();
        itemIndex    = idx;
        scFriendInfo = StaticData.playerInfoData.listFriendInfo[idx];
        //根据经验计算等级
        int level = StaticData.GetPlayerLevelByExp(scFriendInfo.FriendExperience);

        _levelNum.GetComponent <Text>().text = level.ToString();

        if (string.IsNullOrEmpty(scFriendInfo.ImageAddress))
        {
            _iconImage.sprite = ChatTool.GetIcon(scFriendInfo.FriendImage);
        }
        else
        {
            _iconImage.sprite = await ChatTool.GetIcon(scFriendInfo.ImageAddress);
        }

        if (scFriendInfo.Online == true)
        {
            _online.gameObject.SetActive(true);
            _onlineBg.gameObject.SetActive(true);
            _outline.gameObject.SetActive(false);
            _outlineBg.gameObject.SetActive(false);
        }
        else
        {
            _outline.gameObject.SetActive(true);
            _outlineBg.gameObject.SetActive(true);
            _online.gameObject.SetActive(false);
            _onlineBg.gameObject.SetActive(false);
        }
        //昵称
        _stealBtn.gameObject.SetActive(IsSteal(scFriendInfo));

        _nickname.GetComponent <Text>().text = scFriendInfo.FriendName;
        if (scFriendInfo.Uid == StaticData.configExcel.Vertical[0].SpecialUid)
        {
            _btnDelete.gameObject.SetActive(false);
        }
        else
        {
            _btnDelete.gameObject.SetActive(true);
        }
        //_nickname.GetComponent<Text>().text = scFriendInfo.Uid.ToString();
    }
Пример #4
0
    /// <summary>
    /// 加载玩家头像
    /// </summary>
    private async void LoadPlayerIcon()
    {
        var roleID = StaticData.playerInfoData.userInfo.Image;
        var path   = StaticData.configExcel.GetPlayerAvatarByID(roleID);

        ImageIcon.sprite = await ABManager.GetAssetAsync <Sprite>(path.Icon);

        if (Root2dSceneManager._instance != null && Root2dSceneManager._instance.isFriendManor)
        {
            if (string.IsNullOrEmpty(StaticData.playerInfoData.userInfo.ImageAddress))
            {
                ImageIcon.sprite = ChatTool.GetIcon(StaticData.curFriendStealInfo.headIcon);
            }
            else
            {
                ImageIcon.sprite = await ChatTool.GetIcon(StaticData.playerInfoData.userInfo.ImageAddress);
            }
        }
    }
Пример #5
0
    /// <summary>
    /// 展示数据
    /// </summary>
    async void ShowData()
    {
        if (string.IsNullOrEmpty(_currData._iconUrl))
        {
            _icon.sprite = ChatTool.GetIcon(_currData._iconId);
        }
        else
        {
            _icon.sprite = await ChatTool.GetIcon(_currData._iconUrl);
        }

        _showName.text        = _currData._playName;
        _gradeShowText.text   = StaticData.GetPlayerLevelByExp((int)_currData._experience).ToString();
        _contentShowText.text = ChatTool.TextLineFeed(_currData._message, 25);
        LayoutRebuilder.ForceRebuildLayoutImmediate(_contentBoxTraTwo);
        LayoutRebuilder.ForceRebuildLayoutImmediate(_contentBoxTra);
        LayoutRebuilder.ForceRebuildLayoutImmediate(_thisRect);
        SetCornerTra();
        ChatPanelController._Instance.CoerceItemBoxRefresh();
    }
Пример #6
0
    /// <summary>
    /// 生成好友列表中LoopItem后的回调函数
    /// 改变每个LoopItem的参数
    /// </summary>
    /// <param name="idx"></param>
    public async void ScrollCellIndex(int idx)
    {
        Initial();
        itemIndex     = idx;
        scOtherStruct = StaticData.playerInfoData.listApplyInfo[idx];
        //根据经验计算等级
        int level = StaticData.GetPlayerLevelByExp(scOtherStruct.FriendExperience);

        _levelNum.GetComponent <Text>().text = level.ToString();
        if (string.IsNullOrEmpty(scOtherStruct.ImageAddress))
        {
            _iconImage.sprite = ChatTool.GetIcon(scOtherStruct.FriendImage);
        }
        else
        {
            _iconImage.sprite = await ChatTool.GetIcon(scOtherStruct.ImageAddress);
        }

        //多语言,todo
        if (scOtherStruct.Online == true)
        {
            _online.gameObject.SetActive(true);
            _onlineBg.gameObject.SetActive(true);
            _outline.gameObject.SetActive(false);
            _outlineBg.gameObject.SetActive(false);
        }
        else
        {
            _outline.gameObject.SetActive(true);
            _outlineBg.gameObject.SetActive(true);
            _online.gameObject.SetActive(false);
            _onlineBg.gameObject.SetActive(false);
        }
        //昵称
        _nickname.GetComponent <Text>().text = scOtherStruct.FriendName;
        //_nickname.GetComponent<Text>().text = scOtherStruct.Uid.ToString();
    }
Пример #7
0
    /// <summary>
    /// 刷新数据
    /// </summary>
    public async void RefreshDataShow()
    {
        string playerName = ChatTool.GetPrivateChatName(_data);

        if (string.IsNullOrEmpty(playerName))
        {
            _showNameText.text = _data._playName;
        }
        else
        {
            _showNameText.text = ChatTool.GetPrivateChatName(_data);
        }
        if (string.IsNullOrEmpty(_data._iconUrl))
        {
            _icon.sprite = ChatTool.GetIcon(_data.iconId);
        }
        else
        {
            _icon.sprite = await ChatTool.GetIcon(_data._iconUrl);
        }

        _showGradeText.text = StaticData.GetPlayerLevelByExp(ChatTool.GetPrivateChatExperience(_data)).ToString();
        _updateLabelTra.gameObject.SetActive(!_data.IsRead);
    }
Пример #8
0
    /// <summary>
    /// 生成好友列表中LoopItem后的回调函数
    /// 改变每个LoopItem的参数
    /// </summary>
    /// <param name="idx"></param>
    public async void ScrollCellIndex(int idx)
    {
        SetFriendship(Friendship.Normal);
        if (uiFriendComponent.isRecommendUI)
        {
            listRecommendInfo = StaticData.playerInfoData.listRecommendInfo;

            scOtherStruct = listRecommendInfo[idx];
            if (string.IsNullOrEmpty(scOtherStruct.ImageAddress))
            {
                _iconImage.sprite = ChatTool.GetIcon(scOtherStruct.FriendImage);
            }
            else
            {
                _iconImage.sprite = await ChatTool.GetIcon(scOtherStruct.ImageAddress);
            }

            //根据经验计算等级
            int level = StaticData.GetPlayerLevelByExp(scOtherStruct.FriendExperience);
            _levelNum.GetComponent <Text>().text = level.ToString();
            //昵称
            _nickname.GetComponent <Text>().text = scOtherStruct.FriendName;
            //_nickname.GetComponent<Text>().text = scOtherStruct.Uid.ToString();
        }
        else
        {
            scSearch = uiFriendComponent.scSearchInfo;
            if (scSearch != null)
            {
                //根据经验计算等级
                int level = StaticData.GetPlayerLevelByExp(scSearch.Search[idx].FriendExperience);
                _levelNum.GetComponent <Text>().text = level.ToString();

                //昵称
                _nickname.GetComponent <Text>().text = scSearch.Search[idx].FriendName;
                if (string.IsNullOrEmpty(scSearch.Search[idx].ImageAddress))
                {
                    _iconImage.sprite = ChatTool.GetIcon(scSearch.Search[idx].FriendImage);
                }
                else
                {
                    _iconImage.sprite = await ChatTool.GetIcon(scSearch.Search[idx].ImageAddress);
                }

                //_nickname.GetComponent<Text>().text = scSearch.Search[idx].Uid.ToString();
                if (scSearch.Search[idx].IsApply)
                {
                    SetFriendship(Friendship.IsApply);
                }
                else
                {
                    scOtherStruct = new SCFriendInfo()
                    {
                        Uid              = scSearch.Search[idx].Uid,
                        FriendName       = scSearch.Search[idx].FriendName,
                        FriendExperience = scSearch.Search[idx].FriendExperience,
                        FriendImage      = scSearch.Search[idx].FriendImage,
                        Online           = scSearch.Search[idx].Online
                    };
                }
                //判定是否在好友列表中
                RepeatedField <SCFriendInfo> listFriendInfo = StaticData.playerInfoData.listFriendInfo;
                foreach (SCFriendInfo friendInfo in listFriendInfo)
                {
                    if (friendInfo.Uid == scSearch.Search[idx].Uid)
                    {
                        SetFriendship(Friendship.IsFriend);
                    }
                }
            }
            else
            {
                //需添加空背景,todo
                StaticData.DebugGreen("搜索玩家结果为空~~~");
            }
        }
        if ((scOtherStruct != null && scOtherStruct.Online) || (scSearch != null && scSearch.Search[idx].Online))
        {
            _online.gameObject.SetActive(true);
            _onlineBg.gameObject.SetActive(true);
            _outline.gameObject.SetActive(false);
            _outlineBg.gameObject.SetActive(false);
        }
        else
        {
            _outline.gameObject.SetActive(true);
            _outlineBg.gameObject.SetActive(true);
            _online.gameObject.SetActive(false);
            _onlineBg.gameObject.SetActive(false);
        }
    }