public static void SaveImage(RenderTexture saveTexture, string mask)
    {
        if (saveTexture != null)
        {
            RenderTexture.active = saveTexture;

            Texture2D screenShot = new Texture2D((int)(saveTexture.width), (int)(saveTexture.height),
                                                 TextureFormat.RGB24, false);

            screenShot.ReadPixels(new Rect(0, 0, saveTexture.width, saveTexture.height), 0, 0);

            screenShot.Apply();

            byte[] bytes    = screenShot.EncodeToPNG();
            string filepath = "/storage/emulated/0/Pictures/Screenshots/";

            if (!System.IO.Directory.Exists(filepath))
            {
                System.IO.Directory.CreateDirectory(filepath);
            }

            string filename = filepath + System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss") + mask + ".png";

            System.IO.File.WriteAllBytes(filename, bytes);

            RenderTexture.active = null;
            Debug.Log("list111");
            PicoUnityActivity.CallObjectMethod("refresh", filepath);
        }
    }
Beispiel #2
0
    /*
     * 获取语音助手的绑定状态
     */
    public static bool getBindVoiceStatus()
    {
        bool status = false;

                #if UNITY_EDITOR
        status = true;
                #elif UNITY_ANDROID
        PicoUnityActivity.CallObjectMethod <bool> (ref status, "getBindVoiceStatus");
                #endif
        LogUtils.Log("Bind VoiceAssistant Status : " + status);
        return(status);
    }
 // 关闭语音详情面板
 public void CloseVoicePanel()
 {
     LogUtils.Log("CloseVoicePanel");
     if (currentVoiceType == VoiceType.TTS)
     {
         PicoUnityActivity.CallObjectMethod("stopTTS");             //关闭tts
     }
     else if (currentVoiceType == VoiceType.RECORD)
     {
         PicoUnityActivity.CallObjectMethod("vadEnd");             //关闭语音识别
     }
     SwitchPanel(false);
 }
 // 点击“语音详情面板中语音图标”,开始语音识别
 public void WakeUp2()
 {
     if (!OtherUtils.Instance.GetNetStatus())
     {
         Toast.Show(Localization.Get("Net_TimeOut"));
         PicoUnityActivity.CallObjectMethod("wakeUp");
     }
     else
     {
         if (currentVoiceType == VoiceType.TTS)
         {
             PicoUnityActivity.CallObjectMethod("stopTTS");        //关闭tts
         }
         PicoUnityActivity.CallObjectMethod("wakeUp");             //唤醒语音识别
     }
 }
    // 点击“语音助手面板”,开始语音识别
    public void WakeUp()
    {
        int sp_tmall_protocol_value = OtherUtils.Instance.GetIntDataFromSp(Constant.SP_TMALL_PROTOCOL_KEY, Constant.SP_TMALL_PROTOCOL_DEF_VALUE);

        LogUtils.Log("sp_tmall_protocol_value = " + sp_tmall_protocol_value);
        if (sp_tmall_protocol_value != Constant.SP_TMALL_PROTOCOL_VALUE)
        {
            VoiceDialog.Show();
            return;
        }
        if (!OtherUtils.Instance.GetNetStatus())
        {
            //网络未连接,弹出提示
            Toast.Show(Localization.Get("Net_TimeOut"));
            //网络未连接,唤醒语音,会反馈“网络有点问题,请连接网络”
            PicoUnityActivity.CallObjectMethod("wakeUp");
        }
        else
        {
            PicoUnityActivity.CallObjectMethod("wakeUp");
            SwitchPanel(true);
        }
    }
 // 关闭audio
 public void StopAudio()
 {
     PicoUnityActivity.CallObjectMethod("stopAudio");
 }
Beispiel #7
0
    // Update is called once per frame
//	void Update () {
//
//	}

    /*
     * 清除最近使用
     */
    public void RemoveTasks()
    {
        LogUtils.Log("RemoveTasks");
        PicoUnityActivity.CallObjectMethod("removeAppTasks");
    }