void Start()
    {
        audioSrc = GetComponent <AudioSource>();
        float volume = PlayerPrefsManager.GetSFX();

        audioSrc.volume   = volume;
        gameSession       = FindObjectOfType <GameSession>();
        ballInstantiation = FindObjectOfType <BallInstantiation>().GetComponent <BallInstantiation>();
        dialog            = FindObjectOfType <Dialog>();
        if (!dialog)
        {
            dialogV2 = FindObjectOfType <VoiceDialog>();
            Debug.Log("cant find dialog using dialog v2");
        }
        anim           = GetComponent <Animator>();
        Dots           = GameObject.Find("dots");
        rb.isKinematic = (true);
        coll.enabled   = false;
        startPosition  = transform.position;
        Path           = Dots.transform.Cast <Transform> ().ToList().ConvertAll(t => t.gameObject);//Convert children in game
        for (int i = 0; i < Path.Count; i++)
        {
            Path [i].GetComponent <Renderer> ().enabled = false;
        }
    }
Example #2
0
 // Update is called once per frame
 void Update()
 {
             #if UNITY_EDITOR
     if (Input.GetKeyDown(KeyCode.A))
     {
         Dialog.Show(Localization.Get("Update_Title"), Localization.Get("Dialog_Ok"), Localization.Get("Dialog_Cancel"), () => {
         }, () => {
         });
     }
     if (Input.GetKeyDown(KeyCode.B))
     {
         Dialog.Show("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "ok", () => {
         });
     }
     if (Input.GetKeyDown(KeyCode.C))
     {
         ToastController.Show(false);
     }
     if (Input.GetKeyDown(KeyCode.U))
     {
         UpdateDialog.Show("");
     }
     if (Input.GetKeyDown(KeyCode.T))
     {
         Localization.language = "en";
         TipDialog.Show();
     }
     if (Input.GetKeyDown(KeyCode.V))
     {
         VoiceDialog.Show();
     }
     if (Input.GetKeyDown(KeyCode.M))
     {
         maskImage.color = Color.black;
     }
     if (Input.GetKeyDown(KeyCode.O))
     {
         Toast.Show("This is a toast.");
     }
             #endif
 }
Example #3
0
 public static void Show()
 {
     DialogManager.Instance.ClosePrevDialog();
     if (uiRoot == null)
     {
         uiRoot = GameObject.Find("UI Root").transform;
     }
     if (instance == null)
     {
         GameObject go = Resources.Load("Prefab/VoiceDialog") as GameObject;
         if (go != null)
         {
             GameObject obj = Instantiate(go);
             obj.transform.parent        = uiRoot;
             obj.transform.localScale    = 1.0f * Vector3.one;
             obj.transform.localPosition = new Vector3(0f, 0f, -5f);
             instance = obj.GetComponent <VoiceDialog> ();
         }
     }
     instance.gameObject.SetActive(true);
     DialogManager.Instance.Show(instance);
 }
Example #4
0
    // 点击“语音助手面板”,开始语音识别
    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);
        }
    }
Example #5
0
 public void ClosePrevDialog()
 {
     if (this.baseDialog != null)
     {
         string dialogName = this.baseDialog.name;
         LogUtils.Log("关闭Dialog--->" + dialogName);
         if (dialogName == "Dialog(Clone)")
         {
             Dialog.Close();
         }
         else if (dialogName == "TipDialog(Clone)")
         {
             TipDialog.Close();
         }
         else if (dialogName == "UpdateDialog(Clone)")
         {
             UpdateDialog.Close();
         }
         else if (dialogName == "VoiceDialog(Clone)")
         {
             VoiceDialog.Close();
         }
     }
 }