Example #1
0
 /// <summary>
 /// 设置播放音量  同步牌局音量
 /// </summary>
 /// <param name="volume"></param>
 public void SetVolume(float volume)
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         NativeManager.OnFuncCall("setVolume", volume);
     }
     else if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         NativeManager.SetVolume(volume);
     }
 }
Example #2
0
 /// <summary>
 /// 登出
 /// </summary>
 public void LoginOut()
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         NativeManager.OnFuncCall("KeFuLoginOut");
     }
     else if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         NativeManager.KeFuLoginOut();
     }
 }
Example #3
0
 /// <summary>
 /// 设置对话组
 /// </summary>
 /// <param name="groupId"></param>
 public void SetConversation(string groupId)
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         NativeManager.OnFuncCall("IMSetConversation", groupId);
     }
     else if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         NativeManager.SetConversation(groupId);
     }
 }
Example #4
0
 /// <summary>
 /// 离开对话组
 /// </summary>
 public void ClearConversation()
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         NativeManager.OnFuncCall("IMLeaveConversation");
     }
     else if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         NativeManager.ClearConversation();
     }
 }
Example #5
0
 /// <summary>
 /// 发送文本信息
 /// </summary>
 /// <param name="str"></param>
 public void SendMessage(string str)
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         NativeManager.OnFuncCall("IMSendMessage", str);
     }
     else if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         NativeManager.IMSendMessage(str);
     }
 }
Example #6
0
 /// <summary>
 /// 加入对话组 不带发送操作
 /// </summary>
 /// <param name="groupId"></param>
 public void ApplyJoinGroup(string groupId)
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         NativeManager.OnFuncCall("ApplyJoinGroup", groupId);
     }
     else if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         NativeManager.ApplyJoinGroup(groupId);
     }
 }
Example #7
0
 /// <summary>
 /// 停止播放录音音效
 /// </summary>
 public void StopVoice()
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         NativeManager.OnFuncCall("StopVoice");
     }
     else if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         NativeManager.StopVoice();
     }
 }
Example #8
0
 /// <summary>
 /// 播放录音音效
 /// </summary>
 public void PlayVoice(string path)
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         NativeManager.OnFuncCall("PlayVoice", path);
     }
     else if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         NativeManager.PlayVoice(path);
     }
 }
Example #9
0
 /// <summary>
 /// 调用原生登录退出
 /// </summary>
 public void LoginOut()
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         NativeManager.OnFuncCall("IMLoginOut");
     }
     else if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         NativeManager.IMLoginOut();
     }
     isKeepAlive = false;
 }
Example #10
0
 /// <summary>
 /// 停止播放录音音效
 /// </summary>
 public bool IsPlayingVoice()
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         return(NativeManager.OnFuncCall <bool>("IsPlayingVoice"));
     }
     else if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(NativeManager.IsPlayingVoice());
     }
     return(false);
 }
Example #11
0
 /// <summary>
 /// 停止录音
 /// </summary>
 /// <param name="isSend">是否发送到聊天组</param>
 /// <returns>音频的毫秒数,如果返回0, 表示录制失败, 或者时间不够</returns>
 public long StopRecord(bool isSend)
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         return(NativeManager.OnFuncCall <long>("StopRecord", isSend));
     }
     else if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(NativeManager.StopRecord(isSend));
     }
     return(0);
 }
Example #12
0
 /// <summary>
 /// 开始录音
 /// </summary>
 public bool StartRecord()
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         return(NativeManager.OnFuncCall <bool>("StartRecord"));
     }
     else if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(NativeManager.StartRecord());
     }
     return(false);
 }
Example #13
0
 /// <summary>
 /// 返回IM当前状态 -1未实例化 0-未登录 , 1-登录中, 2已登录
 /// </summary>
 /// <returns></returns>
 public int GetImState()
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         return(NativeManager.OnFuncCall <int>("GetImState"));
     }
     else if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(NativeManager.GetImState());
     }
     return(0);
 }
Example #14
0
        /// <summary>
        /// 登录
        /// </summary>
        public void Login(string userId, string uersName)
        {
            string uname  = $"{uersName}({userId})";
            int    status = 0;

            if (Application.platform == RuntimePlatform.Android)
            {
                status = NativeManager.OnFuncCall <int>("KeFuLogin", userId, uname);
            }
            else if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                status = NativeManager.KeFuLogin(userId, uname);
            }
            Log.Debug($"KeFuLogin status = {status}");
        }
Example #15
0
        /// <summary>
        /// 初始化SDK
        /// </summary>
        void Init()
        {
            String siteid = "kf_10535";
            String sdkkey = "c5403fda-4a16-4fbe-85e7-cf7041928e12";//

            if (Application.platform == RuntimePlatform.Android)
            {
                Log.Debug($"siteid = {siteid} , sdkkey = {sdkkey}");
                NativeManager.OnFuncCall("KeFuInit", siteid, sdkkey);
            }
            else if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                NativeManager.KeFuInit(siteid, sdkkey);
            }
        }
Example #16
0
        /// <summary>
        /// 调用原生登录接口
        /// </summary>
        /// <param name="t"></param>
        void NativeCallLogin(string t)
        {
            TalkingDataSdkComponent.Instance.UploadSdkAnalysis("im - login call");
            int appid = 0;

            if (GlobalData.Instance.serverType == 0)
            {
                appid = 1400154930;
            }
            else if (GlobalData.Instance.serverType == 2)
            {
                appid = 1400154934;
            }
            else
            {
                appid = 1400154932;
            }

            if (Application.platform == RuntimePlatform.Android)
            {
                NativeManager.OnFuncCall("IMLogin", GameCache.Instance.nUserId.ToString(), t, appid, "crazyAdmin");
            }
            else if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                NativeManager.IMLogin(GameCache.Instance.nUserId.ToString(), t, appid, "crazyAdmin");
            }

            int state = GetImState();

            if (state < 0)
            {
                //接口错误时上传到bugly
                BuglySdkComponent.Instance.ReportException("sdk im", "error im init ", "");
            }
            else if (state == 0)
            {
                //接口错误时上传到bugly
                BuglySdkComponent.Instance.ReportException("sdk im", "error im login ", "");
                TalkingDataSdkComponent.Instance.UploadSdkAnalysis("im - init succ");
            }
            else
            {
                TalkingDataSdkComponent.Instance.UploadSdkAnalysis("im - init succ");
                TalkingDataSdkComponent.Instance.UploadSdkAnalysis("im - login succ");
            }
        }
Example #17
0
        /// <summary>
        /// 调起聊天窗口
        /// </summary>
        public void StarChat(ChatParamsBody chatParams)
        {
            String settingid = "kf_10535_1558941800319";
            String groupName = "客服链接中...";
            string strbody   = JsonHelper.ToJson(chatParams);
            int    status    = 0;

            if (Application.platform == RuntimePlatform.Android)
            {
                status = NativeManager.OnFuncCall <int>("StartChat", settingid, groupName, strbody);////
            }
            else if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                status = NativeManager.StartChat(settingid, groupName, strbody);
            }
            Log.Debug($"StartChat :: status = {status}");
        }