예제 #1
0
파일: ChatMng.cs 프로젝트: atom-chen/tianyu
 public void VoiceRecordMainWnd(bool _isPress, ChatInfo.Type _type, string name = null)
 {
     //Debug.Log("VoiceRecordMainWnd :  " + _isPress);
     if (_isPress)
     {
         SetIsRcordingVoice(true);
         YvVoiceSdk.YvVoiceRecordVoice();
         recordTime = Time.time;
     }
     else
     {
         SetIsRcordingVoice(false);
         float overTime = Time.time - recordTime;
         if (OnShowSendVoiceUpdate != null)
         {
             OnShowSendVoiceUpdate(true);
         }
         YvVoiceSdk.YvVoiceStopRecordVoice((data1, data2) =>
         {
             string st = "[Voice]=[Voice]=" + data1 + "=[Voice]=" + data2 + "=[Voice]=" + (overTime);
             if (!string.IsNullOrEmpty(name))
             {
                 GameCenter.chatMng.SendChatContent(st, (int)_type, name);
             }
             else
             {
                 GameCenter.chatMng.SendChatContent(st, (int)_type);
             }
             if (OnShowSendVoiceUpdate != null)
             {
                 OnShowSendVoiceUpdate(false);
             }
         });
     }
 }
예제 #2
0
 public VoiceData(string _privateName)
 {
     type = ChatInfo.Type.Private;
     if (_privateName != null)
     {
         privateName = _privateName;
     }
 }
예제 #3
0
파일: ChatMng.cs 프로젝트: atom-chen/tianyu
 /// <summary>
 /// 获取当前玩家的未读聊天数目
 /// </summary>
 public int GetChatNumIsNotRead(ChatInfo.Type _type)
 {
     if (chatNumDic.ContainsKey(_type))
     {
         return(chatNumDic[_type]);
     }
     return(0);
 }
예제 #4
0
파일: ChatMng.cs 프로젝트: atom-chen/tianyu
 void ResetData()
 {
     allChatInfo.Clear();
     chatInfoDic.Clear();
     PrivateChatDic.Clear();
     PrivateChatNewNum.Clear();
     AllPrivateChatNewNum = 0;
     bgmValue             = 0;
     soundEffectValue     = 0;
     chatNumDic.Clear();
     CurTargetName = string.Empty;
     curChatType   = ChatInfo.Type.World;
     ClearVoiceCach();
 }
예제 #5
0
파일: ChatMng.cs 프로젝트: atom-chen/tianyu
 /// <summary>
 /// 获取保存的聊天内容
 /// </summary>
 public void GetSavedContent()
 {
     if (PlayerPrefs.HasKey(SAVED_CHAT))
     {
         string   saved   = PlayerPrefs.GetString(SAVED_CHAT);
         string[] content = saved.Split('/');
         if (content.Length > 0)
         {
             savedChatType = (ChatInfo.Type)(int.Parse(content[0]));
         }
         if (content.Length > 1)
         {
             savedChat = content[1];
         }
     }
     else
     {
         SaveContent();
     }
 }
예제 #6
0
파일: ChatMng.cs 프로젝트: atom-chen/tianyu
 /// <summary>
 /// 更新每个聊天类型新增加的聊天数目(_operaterType=1加新消息,2,清空,玩家在选择这个选项时清空)
 /// </summary>
 protected void SetchatNumDic(ChatInfo.Type _type, int _operaterType)
 {
     if (!chatNumDic.ContainsKey(_type))
     {
         chatNumDic.Add(_type, 0);
     }
     if (_operaterType == 1)
     {
         chatNumDic[_type]++;
     }
     else if (_operaterType == 2)
     {
         chatNumDic[_type] = 0;
         if (_type == ChatInfo.Type.All)
         {
             if (chatNumDic.ContainsKey(ChatInfo.Type.Team))
             {
                 chatNumDic[ChatInfo.Type.Team] = 0;
             }
             if (chatNumDic.ContainsKey(ChatInfo.Type.Guild))
             {
                 chatNumDic[ChatInfo.Type.Guild] = 0;
             }
         }
         if (_type == ChatInfo.Type.World)//系统的消息在世界里面,所以在世界里清空
         {
             if (chatNumDic.ContainsKey(ChatInfo.Type.System))
             {
                 chatNumDic[ChatInfo.Type.System] = 0;
             }
         }
     }
     if (ChatNumChangeEvent != null)
     {
         ChatNumChangeEvent();
     }
 }
예제 #7
0
 public VoiceData(ChatInfo.Type _type)
 {
     type = _type;
 }
예제 #8
0
파일: ChatMng.cs 프로젝트: atom-chen/tianyu
 /// <summary>
 /// 发送指定聊天类型的信息
 /// </summary>
 /// <param name="_type"></param>
 /// <param name="_content"></param>
 public void SendMsgByType(ChatInfo.Type _type, string _content, string _targetName = "")
 {
     // Debug.Log("发送的消息为:" + _content);
     SendChatContent(_content, (int)_type, _targetName);
 }
예제 #9
0
파일: ChatMng.cs 프로젝트: atom-chen/tianyu
 /// <summary>
 /// 复原保存内容
 /// </summary>
 public void RecoverSavedContent()
 {
     savedChatType = ChatInfo.Type.All;
     savedChat     = string.Empty;
 }
예제 #10
0
파일: ChatMng.cs 프로젝트: atom-chen/tianyu
    ///// <summary>
    ///// 设置语音是否自动播放
    ///// </summary>
    ///// <param name="_type"></param>
    ///// <param name="_isSelect"></param>
    //public void SetChatTypeVoiceSelfPlaying(ChatInfo.Type _type, bool _isSelect)
    //{
    //    string type = _type.ToString();
    //    PlayerPrefs.SetInt(type, _isSelect ? 1 : 0);
    //    if (!_isSelect)
    //    {
    //        ClearVoiceListAlongSelfSet(_type);
    //    }
    //}

    /// <summary>
    /// 获得语音自动播放设置
    /// </summary>
    /// <param name="_type"></param>
    /// <returns></returns>
    //public bool GetChatTypeVoiceSelfPlaying(ChatInfo.Type _type)
    //{
    //    string type = _type.ToString();
    //    //   Debug.Log(PlayerPrefs.HasKey(type) + ":" + YvVoiceSdk.IsWifiNetWork() + ":" + type);
    //    if (PlayerPrefs.HasKey(type) && YvVoiceSdk.IsWifiNetWork())
    //    {
    //        return PlayerPrefs.GetInt(type) == 1;
    //    }
    //    else
    //    {
    //        PlayerPrefs.SetInt(type, YvVoiceSdk.IsWifiNetWork() ? 1 : 0);
    //        return PlayerPrefs.GetInt(type) == 1;
    //    }

    //}

    /// <summary>
    /// 设置自动播放时的语音数据清理
    /// </summary>
    protected void ClearVoiceListAlongSelfSet(ChatInfo.Type _type)
    {
        voiceList.RemoveAll((ChatInfo temp) => temp.chatTypeID == (int)_type);
    }
예제 #11
0
파일: ChatWnd.cs 프로젝트: atom-chen/tianyu
    /// <summary>
    /// 有新的聊天记录更新聊天内容
    /// </summary>
    void ShowChatContent(ChatInfo _info)
    {
        ChatInfo.Type   curChatType = GameCenter.chatMng.CurChatType;
        List <ChatInfo> infoList    = GameCenter.chatMng.GetInfoList((int)curChatType);
        int             chatCount   = infoList.Count;
        int             type        = 1;

        if (chatUIList.Count < chatCount)
        {
            switch (_info.chatTypeID)
            {
            //case 5: type = 5; break;
            case 1:
            case 2:
            case 3:
            case 4:
                if (_info.senderID != GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID)
                {
                    type = 4;
                }
                else
                {
                    type = 2;
                }
                break;

            default:
                break;
            }
            ChatContentUI chatUI = InstantiateChatContentUI(type);
            if (type == 2 || type == 3 || type == 4)
            {
                chatUI.ShowPrivateContent(_info);
            }
            else
            {
                chatUI.ShowContent(_info);
            }
            chatUIList.Add(chatUI);
        }
        else
        {
            if (type != 4 && type != 3 && type != 2 && type != 1)
            {
                chatUIList[chatCount - 1].ShowContent(_info);//
            }
            else
            {
                chatUIList[chatCount - 1].ShowPrivateContent(_info);
            }
            chatUIList[chatCount - 1].gameObject.SetActive(true);
        }
        if (chatUIList.Count > 1)
        {
            AddNewChatContentUI(chatUIList.Count - 2);
        }
        //  chatContentUIParent.Reposition();
        view.ResetPosition();
        if (view.shouldMoveVertically)
        {
            view.SetDragAmount(0.01f, 1.0f, false);
        }

        //BoxCollider box = chatContentUIParent.GetComponent<BoxCollider>();
        //if (box != null)
        //{
        //    box.enabled = infoList.Count >= 5;
        //    box.size = new Vector3(box.size.x, (float)83 * infoList.Count, box.size.z);
        //    box.center = new Vector3(box.center.x, -41.5f * (infoList.Count - 1), box.center.z);
        //}
    }