コード例 #1
0
ファイル: ChatContentUI.cs プロジェクト: atom-chen/tianyu
    /// <summary>
    /// 语音聊天刷新
    /// </summary>
    /// <param name="_info"></param>
    public void ShowPrivateContent(ChatInfo _info)
    {
        if (_info == null)
        {
            return;
        }
        if (chatfuncshion != null)
        {
            chatfuncshion.init(_info);
        }
        curInfo = _info;
        if (voiceRedObj != null)
        {
            voiceRedObj.SetActive(false);
        }
        StopAni();
        if (headSprite != null && _info.sendProf != 0)
        {
            PlayerConfig Ref = ConfigMng.Instance.GetPlayerConfig(_info.sendProf);
            if (Ref != null)
            {
                headSprite.spriteName = Ref.res_head_Icon;
                headSprite.MakePixelPerfect();
            }
            else
            {
                headSprite.gameObject.SetActive(false);
                if (headObj != null)
                {
                    headObj.SetActive(false);
                }
            }
        }

        if (chatContent == null)
        {
            return;
        }
        //聊天类型
        string[] str = _info.ChatContent.Split(':');
        if (str.Length >= 2)
        {
            chatContent.text = str[1];
        }
        else
        {
            Debug.LogError("聊天信息数据错误  by黄洪兴");
        }
        if (NGUIMath.CalculateRelativeWidgetBounds(chatContent.transform).size.x >= 650)
        {
            chatContent.overflowMethod = UILabel.Overflow.ResizeHeight;
            chatContent.width          = 650;
        }
        if (sendName != null)
        {
            if (curInfo.senderID != GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID)
            {
                sendName.text = "[u]" + curInfo.senderName + curInfo.sendTime;
            }
            else
            {
                UIwenbenRef Ref = ConfigMng.Instance.GetUITextRef(86);
                if (Ref != null)
                {
                    sendName.text = curInfo.sendTime + Ref.text;
                }
                else
                {
                    sendName.text = curInfo.sendTime;
                }
            }
        }
        if (curInfo.isVoice)
        {
            if (chatContent != null)
            {
                chatContent.text = string.Empty;
                UIEventListener.Get(chatContent.gameObject).onClick = PlayVoice;
            }
            if (voiceCount != null)
            {
                voiceCount.text = curInfo.voiceCont.ToString() + "\"";
            }
            if (voiceContentSprite != null)
            {
                voiceContentSprite.ResetAnchors();
                voiceContentSprite.width = 120;
            }
            if (selfVoiceContentSprite != null)
            {
                selfVoiceContentSprite.ResetAnchors();
                selfVoiceContentSprite.width = 120;
            }
            if (voiceRedObj != null)
            {
                voiceRedObj.SetActive(curInfo.voiceRed);
            }
        }
        if (voiceSprite != null)
        {
            voiceSprite.SetActive(curInfo.isVoice);
        }
        if (otherWords != null)
        {
            otherWords.SetActive(_info.senderID != GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID && !_info.isSystemInfo);
        }
        if (selfWords != null)
        {
            selfWords.SetActive(_info.senderID == GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID && !_info.isSystemInfo);
        }
    }
コード例 #2
0
    void RefreshSoulNum(int _soulID, bool islock = false)
    {
        if (VIPref == null)
        {
            return;
        }
        UIwenbenRef TextRef = ConfigMng.Instance.GetUITextRef(68);

        soulID = _soulID;
        if (GameCenter.castSoulMng.CommonCastSoulNum.ContainsKey(_soulID))
        {
            if (TextRef != null)
            {
                commonCastSoulNum.text = TextRef.text + GameCenter.castSoulMng.CommonCastSoulNum[_soulID].ToString();
            }
        }
        if (GameCenter.castSoulMng.AdvancedCastSoulNum.ContainsKey(_soulID))
        {
            if (TextRef != null)
            {
                advancedCastSoulNum.text = TextRef.text + GameCenter.castSoulMng.AdvancedCastSoulNum[_soulID].ToString();
            }
        }
        reward = new EquipmentInfo(ConfigMng.Instance.GetCastSoulRef(_soulID).normalItem [0].eid,
                                   ConfigMng.Instance.GetCastSoulRef(_soulID).normalItem [0].count,
                                   EquipmentBelongTo.PREVIEW);
        //rewardItem.FillInfo (reward);
        if (commonCastSoulConsume != null)
        {
            int castsoulnum = 0;
            if (VIPref != null)
            {
                castsoulnum = VIPref.cast_soul_num - GameCenter.castSoulMng.CommonCastSoulNum[_soulID] + 1;
                CastSoulTimeRef Ref = ConfigMng.Instance.GetCastSoulTimeRef(castsoulnum);
                if (Ref != null)
                {
                    if ((ulong)Ref.giftMoney[0].count <= GameCenter.mainPlayerMng.MainPlayerInfo.RealYuanCount)
                    {
                        commonCastSoulConsume.text = Ref.giftMoney[0].count.ToString() + "/" + GameCenter.mainPlayerMng.MainPlayerInfo.RealYuanCount.ToString();
                    }
                    else
                    {
                        commonCastSoulConsume.text = Ref.giftMoney[0].count.ToString() + "/" + "[FF0000]" + GameCenter.mainPlayerMng.MainPlayerInfo.RealYuanCount.ToString();
                    }
                }
            }
        }
        if (advancedCastSoulConsume != null)
        {
            int castsoulnum = 0;
            if (VIPref != null)
            {
                castsoulnum = VIPref.cast_soul_num - GameCenter.castSoulMng.AdvancedCastSoulNum[_soulID] + 1;
                CastSoulTimeRef Ref = ConfigMng.Instance.GetCastSoulTimeRef(castsoulnum);
                if (Ref != null)
                {
                    if ((ulong)Ref.specialMoney[0].count <= GameCenter.mainPlayerMng.MainPlayerInfo.TotalDiamondCount)
                    {
                        advancedCastSoulConsume.text = Ref.specialMoney[0].count.ToString() + "/" + GameCenter.mainPlayerMng.MainPlayerInfo.TotalDiamondCount.ToString();
                    }
                    else
                    {
                        advancedCastSoulConsume.text = Ref.specialMoney[0].count.ToString() + "/" + "[FF0000]" + GameCenter.mainPlayerMng.MainPlayerInfo.TotalDiamondCount.ToString();
                    }
                }
            }
        }
    }