Exemplo n.º 1
0
 // Token: 0x0600C6E4 RID: 50916 RVA: 0x00371780 File Offset: 0x0036F980
 public static void PlayPlayerVoice(ChatVoiceMessage chatInfo, Action onStartPlayVoice = null)
 {
     if (chatInfo.VoiceData != null && chatInfo.VoiceData.Length != 0)
     {
         float[]   data      = AudioUtility.NormalizeVolume(VoiceChatCompression.Instance.Decompress(chatInfo.VoiceData, chatInfo.SampleLength, VoiceChatCompressionType.Speex));
         AudioClip audioClip = AudioClip.Create("TempClip", chatInfo.SampleLength, 1, chatInfo.AudioFrequency, false);
         audioClip.SetData(data, 0);
         if (CommonUIController.Instance != null)
         {
             AudioUtility.SetVolume("All_Game_Sounds", 0.05f, true);
         }
         GameManager.Instance.AudioManager.PlayPlayerVoice(audioClip, 1f);
         if (CommonUIController.Instance != null)
         {
             float soundEndTime = Time.unscaledTime + (float)chatInfo.VoiceLength;
             CommonUIController.Instance.StartCoroutine(new WaitUntil(delegate()
             {
                 if (Time.unscaledTime > soundEndTime)
                 {
                     AudioUtility.SetVolume("All_Game_Sounds", 1f, true);
                     return(true);
                 }
                 return(false);
             }));
         }
         if (onStartPlayVoice != null)
         {
             onStartPlayVoice();
         }
     }
 }
        // Token: 0x0600B2A4 RID: 45732 RVA: 0x00316730 File Offset: 0x00314930
        public void ShowVoice(ChatVoiceMessage voiceMessage)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_ShowVoiceChatVoiceMessage_hotfix != null)
            {
                this.m_ShowVoiceChatVoiceMessage_hotfix.call(new object[]
                {
                    this,
                    voiceMessage
                });
                return;
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            this.m_dialogText.gameObject.SetActive(false);
            this.m_expressionImage.gameObject.SetActive(false);
            this.m_voiceButton.gameObject.SetActive(true);
            this.m_voiceMessage             = voiceMessage;
            this.m_voiceTimeButtonText.text = voiceMessage.VoiceLength + "'";
            string translateText = voiceMessage.TranslateText;
            bool   active        = translateText != string.Empty && translateText != null;

            this.m_voiceContentText.gameObject.SetActive(active);
            this.m_voiceContentText.text = translateText;
            this.m_chatUIStateController.SetToUIState("Show", false, true);
            IConfigDataLoader configDataLoader = GameManager.Instance.ConfigDataLoader as IConfigDataLoader;

            this.m_hideChatTime = (float)configDataLoader.UtilityGetConfigableConst(ConfigableConstId.ConfigableConstId_TeamChatBubbleStayTime) * 0.001f;
        }
Exemplo n.º 3
0
 // Token: 0x0600C6F2 RID: 50930 RVA: 0x00371CCC File Offset: 0x0036FECC
 private void OnGetVoiceContentAck(ChatVoiceMessage voiceContent)
 {
     if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_OnGetVoiceContentAckChatVoiceMessage_hotfix != null)
     {
         this.m_OnGetVoiceContentAckChatVoiceMessage_hotfix.call(new object[]
         {
             this,
             voiceContent
         });
         return;
     }
     BJLuaObjHelper.IsSkipLuaHotfix = false;
     this.m_voiceContent            = voiceContent;
     base.Stop();
 }
Exemplo n.º 4
0
    public static int get_VoiceData(IntPtr l)
    {
        int result;

        try
        {
            ChatVoiceMessage chatVoiceMessage = (ChatVoiceMessage)LuaObject.checkSelf(l);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, chatVoiceMessage.VoiceData);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Exemplo n.º 5
0
    public static int constructor(IntPtr l)
    {
        int result;

        try
        {
            ChatVoiceMessage o = new ChatVoiceMessage();
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, o);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Exemplo n.º 6
0
    public static int set_VoiceData(IntPtr l)
    {
        int result;

        try
        {
            ChatVoiceMessage chatVoiceMessage = (ChatVoiceMessage)LuaObject.checkSelf(l);
            byte[]           voiceData;
            LuaObject.checkArray <byte>(l, 2, out voiceData);
            chatVoiceMessage.VoiceData = voiceData;
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Exemplo n.º 7
0
    public static int set_InstanceId(IntPtr l)
    {
        int result;

        try
        {
            ChatVoiceMessage chatVoiceMessage = (ChatVoiceMessage)LuaObject.checkSelf(l);
            ulong            instanceId;
            LuaObject.checkType(l, 2, out instanceId);
            chatVoiceMessage.InstanceId = instanceId;
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Exemplo n.º 8
0
    public static int set_TranslateText(IntPtr l)
    {
        int result;

        try
        {
            ChatVoiceMessage chatVoiceMessage = (ChatVoiceMessage)LuaObject.checkSelf(l);
            string           translateText;
            LuaObject.checkType(l, 2, out translateText);
            chatVoiceMessage.TranslateText = translateText;
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Exemplo n.º 9
0
    public static int set_IsOverdued(IntPtr l)
    {
        int result;

        try
        {
            ChatVoiceMessage chatVoiceMessage = (ChatVoiceMessage)LuaObject.checkSelf(l);
            bool             isOverdued;
            LuaObject.checkType(l, 2, out isOverdued);
            chatVoiceMessage.IsOverdued = isOverdued;
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Exemplo n.º 10
0
    public static int set_SampleLength(IntPtr l)
    {
        int result;

        try
        {
            ChatVoiceMessage chatVoiceMessage = (ChatVoiceMessage)LuaObject.checkSelf(l);
            int sampleLength;
            LuaObject.checkType(l, 2, out sampleLength);
            chatVoiceMessage.SampleLength = sampleLength;
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Exemplo n.º 11
0
    public static int set_AudioFrequency(IntPtr l)
    {
        int result;

        try
        {
            ChatVoiceMessage chatVoiceMessage = (ChatVoiceMessage)LuaObject.checkSelf(l);
            int audioFrequency;
            LuaObject.checkType(l, 2, out audioFrequency);
            chatVoiceMessage.AudioFrequency = audioFrequency;
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Exemplo n.º 12
0
 // Token: 0x0600C6E3 RID: 50915 RVA: 0x003716F0 File Offset: 0x0036F8F0
 public static void GetVoiceContentAndPlayVoice(ChatVoiceMessage chatInfo, Action onStartPlayVoice = null)
 {
     if (chatInfo.VoiceData != null)
     {
         VoicePlayer.PlayPlayerVoice(chatInfo, onStartPlayVoice);
     }
     else if (chatInfo.InstanceId != 0UL)
     {
         GetVoiceContentNetTask getVoiceContentNetTask = new GetVoiceContentNetTask(chatInfo.ChannelId, chatInfo.InstanceId);
         getVoiceContentNetTask.EventOnStop += delegate(Task task)
         {
             GetVoiceContentNetTask getVoiceContentNetTask2 = task as GetVoiceContentNetTask;
             chatInfo.VoiceData      = getVoiceContentNetTask2.VoiceContent.VoiceData;
             chatInfo.AudioFrequency = getVoiceContentNetTask2.VoiceContent.AudioFrequency;
             chatInfo.SampleLength   = getVoiceContentNetTask2.VoiceContent.SampleLength;
             VoicePlayer.PlayPlayerVoice(chatInfo, onStartPlayVoice);
         };
         getVoiceContentNetTask.Start(null);
     }
 }
        // Token: 0x0600C460 RID: 50272 RVA: 0x00366370 File Offset: 0x00364570
        private void OnVoiceButtonClick()
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_OnVoiceButtonClick_hotfix != null)
            {
                this.m_OnVoiceButtonClick_hotfix.call(new object[]
                {
                    this
                });
                return;
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            ChatVoiceMessage chatVoiceMessage = this.m_currChatInfo.ChatMessageInfo as ChatVoiceMessage;

            if (this.EventOnVoiceButtonClick != null && chatVoiceMessage != null)
            {
                this.EventOnVoiceButtonClick(this.m_currChatInfo);
            }
            else
            {
                global::Debug.LogError("WorldChatItemUIController::OnVoiceButtonClick::Event Null Or VoiceInfo Null");
            }
        }
Exemplo n.º 14
0
 // Token: 0x0600C70A RID: 50954 RVA: 0x003720A0 File Offset: 0x003702A0
 public void OnGetVoiceContentAck(ChatVoiceMessage voiceContent)
 {
     this.m_owner.OnGetVoiceContentAck(voiceContent);
 }
        // Token: 0x0600C457 RID: 50263 RVA: 0x00365A10 File Offset: 0x00363C10
        public void UpdateChatInfo(ChatComponent.ChatMessageClient chatClientInfo, bool isPlaying = false)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_UpdateChatInfoChatMessageClientBoolean_hotfix != null)
            {
                this.m_UpdateChatInfoChatMessageClientBoolean_hotfix.call(new object[]
                {
                    this,
                    chatClientInfo,
                    isPlaying
                });
                return;
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            this.m_currChatInfo            = chatClientInfo;
            ChatMessage     chatMessageInfo = chatClientInfo.ChatMessageInfo;
            ChatContentType chatContentType = chatMessageInfo.ChatContentType;

            if (chatContentType != ChatContentType.Text)
            {
                if (chatContentType != ChatContentType.Voice)
                {
                    if (chatContentType == ChatContentType.CustomBigExpression)
                    {
                        this.PlayerNameText.text = chatMessageInfo.SrcName;
                        ProjectLPlayerContext projectLPlayerContext = GameManager.Instance.PlayerContext as ProjectLPlayerContext;
                        this.SendTimeText.text = this.SetChatMsgTime(projectLPlayerContext.ServerTimeToLocalTime(chatMessageInfo.SendTime));
                        ChatChannel channelId = chatMessageInfo.ChannelId;
                        if (channelId != ChatChannel.Sys)
                        {
                            this.PlayerIconImage.sprite = AssetUtility.Instance.GetSprite(UIUtility.GetPlayerSmallHeadIconImageName(HeadIconTools.GetHeadPortrait(chatMessageInfo.AvatarId)));
                            UIUtility.SetPlayerHeadFrame(this.PlayerHeadFrameTransform, HeadIconTools.GetHeadFrame(chatMessageInfo.AvatarId), true, "Normal");
                            this.PlayerLevelText.text = chatMessageInfo.SrcPlayerLevel.ToString();
                        }
                        string                      text                        = (chatMessageInfo as ChatTextMessage).Text;
                        int                         key                         = int.Parse(text);
                        IConfigDataLoader           configDataLoader            = GameManager.Instance.ConfigDataLoader as IConfigDataLoader;
                        ConfigDataBigExpressionInfo configDataBigExpressionInfo = configDataLoader.GetConfigDataBigExpressionInfo(key);
                        this.FaceIcon.sprite = AssetUtility.Instance.GetSprite(configDataBigExpressionInfo.ExpressionIconPath);
                        this.SetToBigExpressionMode();
                    }
                }
                else
                {
                    this.PlayerNameText.text = chatMessageInfo.SrcName;
                    ProjectLPlayerContext projectLPlayerContext2 = GameManager.Instance.PlayerContext as ProjectLPlayerContext;
                    this.SendTimeText.text = this.SetChatMsgTime(projectLPlayerContext2.ServerTimeToLocalTime(chatMessageInfo.SendTime));
                    ChatChannel channelId2 = chatMessageInfo.ChannelId;
                    if (channelId2 != ChatChannel.Sys)
                    {
                        this.PlayerIconImage.sprite = AssetUtility.Instance.GetSprite(UIUtility.GetPlayerSmallHeadIconImageName(HeadIconTools.GetHeadPortrait(chatMessageInfo.AvatarId)));
                        UIUtility.SetPlayerHeadFrame(this.PlayerHeadFrameTransform, HeadIconTools.GetHeadFrame(chatMessageInfo.AvatarId), true, "Normal");
                        this.PlayerLevelText.text = chatMessageInfo.SrcPlayerLevel.ToString();
                    }
                    ChatVoiceMessage chatVoiceMessage = chatMessageInfo as ChatVoiceMessage;
                    this.VoiceLengthText.text  = chatVoiceMessage.VoiceLength.ToString() + "'";
                    this.VoiceContentText.text = chatVoiceMessage.TranslateText;
                    if (string.IsNullOrEmpty(chatVoiceMessage.TranslateText))
                    {
                        this.VoiceContentText.gameObject.SetActive(false);
                    }
                    else
                    {
                        this.VoiceContentText.gameObject.SetActive(true);
                    }
                    this.SetToVoiceMode();
                }
            }
            else
            {
                this.PlayerNameText.text = chatMessageInfo.SrcName;
                ProjectLPlayerContext projectLPlayerContext3 = GameManager.Instance.PlayerContext as ProjectLPlayerContext;
                this.SendTimeText.text = this.SetChatMsgTime(projectLPlayerContext3.ServerTimeToLocalTime(chatMessageInfo.SendTime));
                ChatChannel channelId3 = chatMessageInfo.ChannelId;
                if (channelId3 != ChatChannel.Sys)
                {
                    this.PlayerIconImage.sprite = AssetUtility.Instance.GetSprite(UIUtility.GetPlayerSmallHeadIconImageName(HeadIconTools.GetHeadPortrait(chatMessageInfo.AvatarId)));
                    UIUtility.SetPlayerHeadFrame(this.PlayerHeadFrameTransform, HeadIconTools.GetHeadFrame(chatMessageInfo.AvatarId), true, "Normal");
                    this.PlayerLevelText.text = chatMessageInfo.SrcPlayerLevel.ToString();
                }
                string text2 = (chatMessageInfo as ChatTextMessage).Text;
                if (this.m_isEmojiTextInit)
                {
                    this.ContentText.SetContent(text2);
                }
                else
                {
                    this.ContentText.text = text2;
                }
                this.SetToTextMode();
            }
            base.gameObject.SetActive(true);
        }