private void MicroPhonePress(GameObject go, bool isPressed) { if (isPressed) { MicrophoneInput.getInstance().StartRecord(); StartRecord(10); AudioManager.SetMute(true); } else { StopRecord(); MicrophoneInput.getInstance().StopRecord(); byte[] dataBuf = MicrophoneInput.getInstance().GetClipData(); Debuger.Log("录间数据长度:" + dataBuf.Length); byte[] pressBuf = DataZipCenter.CompressByGZIP(dataBuf); Debuger.Log("压缩后数据长度:" + pressBuf.Length); MicrophoneInput.getInstance().PlayRecord(); DealCommand.Instance.SendYuYing(pressBuf.Length, pressBuf); AudioManager.SetMute(false); } }
public void EndRecording() { int length = 0; AudioClip clip = null; if (SoundRecordCenter.EndRecording(out length, out clip)) { byte[] dataBuf = SoundRecordCenter.GetData(clip); byte[] dataBuf2 = SoundRecordCenter.GetClipData(clip); Debuger.Log("录间数据长度:" + dataBuf.Length); Debuger.Log("录间数据长度2:" + dataBuf2.Length); byte[] pressBuf = DataZipCenter.CompressByGZIP(dataBuf); Debuger.Log("压缩后数据长度:" + pressBuf.Length); byte[] pressBuf2 = DataZipCenter.CompressByGZIP(dataBuf2); Debuger.Log("压缩后数据长度2:" + pressBuf2.Length); clip = SoundRecordCenter.SetData(clip, DataZipCenter.DeCompressByGZIP(pressBuf)); AudioManager.Play(clip, false); } }
// Update is called once per frame void Update() { ExitGameLogic(); if (Input.GetKeyDown(KeyCode.Q)) { //StartRecording(); MicrophoneInput.getInstance().StartRecord(); } if (Input.GetKeyDown(KeyCode.W)) { //EndRecording(); MicrophoneInput.getInstance().StopRecord(); byte[] dataBuf = MicrophoneInput.getInstance().GetClipData(); Debuger.Log("录间数据长度:" + dataBuf.Length); byte[] pressBuf = DataZipCenter.CompressByGZIP(dataBuf); Debuger.Log("压缩后数据长度:" + pressBuf.Length); //MicrophoneInput.getInstance().PlayRecord(); byte[] depressBuf = DataZipCenter.DeCompressByGZIP(pressBuf); Debuger.Log("解压后数据长度:" + depressBuf.Length); MicrophoneInput.getInstance().PlayClipData(depressBuf); } if (Input.GetKeyDown(KeyCode.Space)) { ////ViewCenter.Instance.GetPanel<Panel_UI>(PanelType.UIManager).Show_胡(); ////ViewCenter.Instance.GetPanel<Panel_Prompt>(PanelType.Prompt).ShowText("小李子,在干啥呢?"); ////ViewCenter.Instance.GetPanel<Panel_MessageBox>(PanelType.MessageBox).ShowMessageBox("开始游戏了!", "", null); //GameOverData pd = DataCenter.Instance.players[0].gameOver; //pd.huTypeList.Add(HuType.平胡); //pd.ZhongYuList.Add(MJType.条_1); //pd.ZhongYuList.Add(MJType.条_1); //pd.ZhongYuList.Add(MJType.条_1); //pd.ZhongYuList.Add(MJType.条_1); //pd.ZhongYuList.Add(MJType.条_1); //pd.ZhongYuList.Add(MJType.条_1); //pd = DataCenter.Instance.players[3].gameOver; //pd.huTypeList.Add(HuType.平胡); //pd.ZhongYuList.Add(MJType.条_1); //pd.ZhongYuList.Add(MJType.条_1); //pd.ZhongYuList.Add(MJType.条_1); //pd.ZhongYuList.Add(MJType.条_1); //pd.ZhongYuList.Add(MJType.条_1); //pd.ZhongYuList.Add(MJType.条_1); //ViewCenter.Instance.ShowPanel<UIPanelBase>(PanelType.GameOver); } else if (Input.GetKeyDown(KeyCode.Return)) { DataCenter.Instance.players[0].resultList.Clear(); Result_Struct result = new Result_Struct(); result.type = ResultType.碰; result.MJList.Add(MJType.MJ_北); result.MJList.Add(MJType.MJ_北); result.MJList.Add(MJType.MJ_北); DataCenter.Instance.players[0].resultList.Add(result); result = new Result_Struct(); result.type = ResultType.吃; result.MJList.Add(MJType.万_1); result.MJList.Add(MJType.万_2); result.MJList.Add(MJType.万_3); DataCenter.Instance.players[0].resultList.Add(result); result = new Result_Struct(); result.type = ResultType.吃; result.MJList.Add(MJType.万_2); result.MJList.Add(MJType.万_3); result.MJList.Add(MJType.万_4); DataCenter.Instance.players[0].resultList.Add(result); //result = new Result_Struct(); //result.type = ResultType.杠; //result.MJList.Add(MJType.万_2); //DataCenter.Instance.players[0].resultList.Add(result); ViewCenter.Instance.GetPanel <Panel_Player_Bottom>(PanelType.Player_BOTTOM).UpdateResultBtn(DataCenter.Instance.players[0].resultList); //ViewCenter.Instance.GetPanel<Panel_Player_Bottom>(PanelType.Player_BOTTOM).ShowResultMJ(DataCenter.Instance.players[0].resultList, ResultType.吃); } if (Input.GetKeyDown(KeyCode.Y)) { //DealCommand.Instance.SendLogin("浮夸"); //List<Texture> texList = new List<Texture>(); //texList.Add(ResourcesManager.GetTexture("XT")); //texList.Add(ResourcesManager.GetTexture("fankui")); //CreateAtlas.CreatAtlasFromTex(ResourcesManager.GetAtlas(Tags.MJ_DynamicAtlas), texList); //CreateAtlas.CreatAtlasFromTex(ResourcesManager.GetAtlas(Tags.MJ_DynamicAtlas), texList); //DataCenter.Instance.players[0].playerInfo.WXTX_Icon_SpriteName = "fankui"; //DataCenter.Instance.players[1].playerInfo.WXTX_Icon_SpriteName = "XT"; //DataCenter.Instance.players[2].playerInfo.WXTX_Icon_SpriteName = "fankui"; //DataCenter.Instance.players[3].playerInfo.WXTX_Icon_SpriteName = "XT"; } if (Input.GetKeyDown(KeyCode.T)) { //Texture2D texture = ResourcesManager.GetTexture("XT"); //byte[] dataBuf = texture.EncodeToJPG(); //DealCommand.Instance.SendWXTX(dataBuf.Length, dataBuf); //ResDownLoadCenter.Instance.DownLoad("http://wx.qlogo.cn/mmopen/nJZe5ZQpplkuvhlrg9n2hwFyVBwfuCHGuHJia0YX73xTNykkAmE5UNNshicZy5eyBOgj967ibPa7zQEzibpNr4gZQT4ZAibzDkrSq/0", DownLoadResType.Image, ImageDownLoadCall); DealCommand.Instance.SendGETTX(); } if (Input.GetKeyDown(KeyCode.U)) { HistroyRecordData hr = new HistroyRecordData(); hr.WXName_东 = "东"; hr.WinScore_东 = -100; hr.WXName_南 = "南"; hr.WinScore_南 = 100; hr.WXName_西 = "西"; hr.WinScore_西 = 0; hr.WXName_北 = "北"; hr.WinScore_北 = 10; ////DataCenter.Instance.histroyRecordList.Add(hr); ViewCenter.Instance.GetPanel <Panel_Record>(PanelType.Record).AddHistoryRecord(ref hr); //ViewCenter.Instance.ShowPanel<UIPanelBase>(PanelType.GameOver_Record); } if (Input.GetKeyDown(KeyCode.R)) { //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_BOTTOM).ShowAnim(ResultType.糊); //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_RIGHT).ShowAnim(ResultType.吃); //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_TOP).ShowAnim(ResultType.碰); //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_LEFT).ShowAnim(ResultType.杠); //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_BOTTOM).ShowMsg_Face("face_00"); //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_RIGHT).ShowMsg_Face("face_01"); //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_TOP).ShowMsg_Face("face_02"); //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_LEFT).ShowMsg_Face("face_03"); //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_BOTTOM).ShowMsg_Dialogue("怎么又断线了,网络怎么这么差"); //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_RIGHT).ShowMsg_Dialogue("怎么又断线了,网络怎么这么差"); //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_TOP).ShowMsg_Dialogue("怎么又断线了,网络怎么这么差"); //ViewCenter.Instance.GetPanel<Panel_Player>(PanelType.Player_LEFT).ShowMsg_Dialogue("怎么又断线了,网络怎么这么差"); string ip = "", area = "", networkOperator = ""; if (GDFunc.GetPublicIPAddress(ref ip, ref area, ref networkOperator)) { Debuger.Log("IP:" + ip + "----" + area + "----" + networkOperator); } } }