Пример #1
0
 private void ParseVoiceMessage(GUIVoiceChatData voiceChatData, bool isSelf, bool isPlaying, bool isAlreadyPlayed)
 {
     this.mSelfVoiceDesc.text = string.Empty;
     this.mSelfVoiceTimeNum.text = string.Empty;
     this.mTargetVoiceDesc.text = string.Empty;
     this.mTargetVoiceTimeNum.text = string.Empty;
     if (voiceChatData == null)
     {
         return;
     }
     string voiceMsg = voiceChatData.VoiceMsg;
     this.CalVoiceLines(ref voiceMsg, isSelf);
     this.mSb.Remove(0, this.mSb.Length);
     for (int i = 0; i < this.mLineList.Count; i++)
     {
         this.mSb.Append(this.mLineList[i]);
     }
     if (isSelf)
     {
         this.mSelfVoiceBg.SetActive(true);
         this.mSelfMsg.gameObject.SetActive(false);
         this.mSelfVoiceDesc.text = this.mSb.ToString();
         this.mSelfVoiceTimeNum.text = string.Format("{0}\"", voiceChatData.VoiceTime);
         this.mSelfBg.height = ((this.mLineList.Count <= 1 && this.mSelfVoiceDesc.printedSize.y <= 30f) ? 88 : 110);
     }
     else
     {
         this.mTargetVoiceBg.SetActive(true);
         this.mTargetMsg.gameObject.SetActive(false);
         this.mTargetVoiceDesc.text = this.mSb.ToString();
         this.mTargetVoiceTimeNum.text = string.Format("{0}\"", voiceChatData.VoiceTime);
         this.mTargetBg.height = ((this.mLineList.Count <= 1 && this.mTargetVoiceDesc.printedSize.y <= 30f) ? 88 : 110);
     }
     if (isPlaying)
     {
         if (isSelf)
         {
             this.mSelfVoiceNoPlayTag.SetActive(false);
             this.mSelfVoicePlayedTag.SetActive(false);
             this.mSelfVoiceYinLiang.SetActive(true);
         }
         else
         {
             this.mTargetVoiceNoPlayTag.SetActive(false);
             this.mTargetVoicePlayedTag.SetActive(false);
             this.mTargetVoiceYinLiang.SetActive(true);
         }
     }
     else if (isSelf)
     {
         this.mSelfVoiceNoPlayTag.SetActive(!isAlreadyPlayed);
         this.mSelfVoicePlayedTag.SetActive(isAlreadyPlayed);
         this.mSelfVoiceYinLiang.SetActive(false);
     }
     else
     {
         this.mTargetVoiceNoPlayTag.SetActive(!isAlreadyPlayed);
         this.mTargetVoicePlayedTag.SetActive(isAlreadyPlayed);
         this.mTargetVoiceYinLiang.SetActive(false);
     }
 }
Пример #2
0
 private void OnVoiceTranslateDoneEvent(string param, string msg)
 {
     GUIVoiceChatData gUIVoiceChatData = new GUIVoiceChatData();
     gUIVoiceChatData.VoiceTime = this.mRecordTime;
     gUIVoiceChatData.VoiceTranslateParam = param;
     if (msg.Length > 35)
     {
         msg = string.Format("{0}......", msg.Substring(0, 35));
     }
     gUIVoiceChatData.VoiceMsg = msg;
     string message = gUIVoiceChatData.ToJsonData().ToJson();
     MC2S_Chat mC2S_Chat = new MC2S_Chat();
     mC2S_Chat.Message = message;
     mC2S_Chat.Channel = this.mStopRecordChannel;
     mC2S_Chat.PlayerID = ((this.mStopRecordChannel != 2) ? Globals.Instance.Player.Data.ID : this.TargetPlayerID);
     mC2S_Chat.Voice = true;
     Globals.Instance.CliSession.Send(216, mC2S_Chat);
     if (this.mStopRecordChannel == 2)
     {
         Globals.Instance.Player.mCommitTimerPrivate = Globals.Instance.Player.GetTimeStamp() + 2;
     }
     else
     {
         Globals.Instance.Player.mCommitTimer = Globals.Instance.Player.GetTimeStamp() + 15;
     }
 }