|
@@ -34,10 +34,11 @@ public class ERNIEBotManager : MonoBehaviour
|
|
|
private bool isWakeup = false;
|
|
|
|
|
|
private Vector3 irobotPos;
|
|
|
+
|
|
|
private void Awake()
|
|
|
{
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
private void OnEnable()
|
|
|
{
|
|
@@ -108,7 +109,7 @@ public class ERNIEBotManager : MonoBehaviour
|
|
|
{
|
|
|
yield return new WaitForSeconds(times);
|
|
|
|
|
|
- UnityToJava.yiYanClass.CallStatic("SpeekOff", "HelloWord1234568999");
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -144,20 +145,7 @@ public class ERNIEBotManager : MonoBehaviour
|
|
|
{
|
|
|
myt.text = YiYanBack.MyTextlist.Dequeue();
|
|
|
oldMyt = myt.text;
|
|
|
- }
|
|
|
-
|
|
|
- if (isCollect)
|
|
|
- {
|
|
|
- Debug.Log(isCollect);
|
|
|
- isCollect = false;
|
|
|
- StartSpeek();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ }
|
|
|
|
|
|
if (oldback != null && oldback == backt.text)
|
|
|
{
|
|
@@ -172,8 +160,6 @@ public class ERNIEBotManager : MonoBehaviour
|
|
|
}
|
|
|
else
|
|
|
times2 = 0;
|
|
|
-
|
|
|
-
|
|
|
|
|
|
if (oldMyt!=null && myt.text == oldMyt)
|
|
|
{
|
|
@@ -188,11 +174,21 @@ public class ERNIEBotManager : MonoBehaviour
|
|
|
Irobot.gameObject.SetActive(true);
|
|
|
myt.text = "";
|
|
|
backfinalt.text = "";
|
|
|
+ backt.text = "";
|
|
|
|
|
|
StartSpeek();
|
|
|
}
|
|
|
|
|
|
+ if (myt.text.Contains("小度拜拜"))
|
|
|
+ {
|
|
|
+ isWakeup = false;
|
|
|
+ Irobot.gameObject.SetActive(false);
|
|
|
+ StartSpeek();
|
|
|
+ }
|
|
|
+
|
|
|
times += Time.deltaTime;
|
|
|
+ if(times>1f)
|
|
|
+ StartCoroutine(AudioIconSetting(0, false));
|
|
|
if (times > 3f)
|
|
|
{
|
|
|
oldMyt = null;
|
|
@@ -234,45 +230,45 @@ public class ERNIEBotManager : MonoBehaviour
|
|
|
UnityToJava.yiYanClass.CallStatic("StopSpeek");
|
|
|
Debug.Log("StopSpeek====");
|
|
|
}
|
|
|
+
|
|
|
+ public void StartSpeekOnClick()
|
|
|
+ {
|
|
|
+ StartSpeek();
|
|
|
+ YiYanBack.BackText.Clear();
|
|
|
+ YiYanBack.BackText = new Queue<char>();
|
|
|
+ myt.text = "";
|
|
|
+ backt.text = "";
|
|
|
+ }
|
|
|
+
|
|
|
public void StartSpeek()
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
UnityToJava.yiYanClass.CallStatic("StartSpeek");
|
|
|
- Debug.Log("StartSpeek====");
|
|
|
-
|
|
|
- StartCoroutine(AudioIconSetting(1f, true));
|
|
|
+ Debug.Log("StartSpeek====");
|
|
|
+ StartCoroutine(AudioIconSetting(0.7f, true));
|
|
|
}
|
|
|
|
|
|
public void send(string str)
|
|
|
- {
|
|
|
- if(isWakeup)
|
|
|
+ {
|
|
|
+ StartCoroutine(AudioIconSetting(0, false));
|
|
|
+ if (isWakeup)
|
|
|
{
|
|
|
- if (str.Contains("小度拜拜"))
|
|
|
- {
|
|
|
- isWakeup = false;
|
|
|
- Irobot.gameObject.SetActive(false);
|
|
|
-
|
|
|
- StartSpeek();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- UnityToJava.yiYanClass.CallStatic("SendText", str);
|
|
|
- Debug.Log("Send " + str);
|
|
|
- StartCoroutine(AudioIconSetting(1f, false));
|
|
|
- }
|
|
|
-
|
|
|
+ UnityToJava.yiYanClass.CallStatic("SendText", str);
|
|
|
+ Debug.Log("Send " + str);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
StartSpeek();
|
|
|
}
|
|
|
backt.text = "";
|
|
|
+ myt.text = "";
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private IEnumerator OpenSpeek( float times)
|
|
|
{
|
|
|
yield return new WaitForSeconds(times);
|
|
|
- isCollect = true;
|
|
|
+ StartSpeek();
|
|
|
}
|
|
|
|
|
|
private IEnumerator PlayAnimator( string Animator_Name ,float times)
|
|
@@ -286,6 +282,11 @@ public class ERNIEBotManager : MonoBehaviour
|
|
|
|
|
|
private IEnumerator AudioIconSetting(float times , bool state)
|
|
|
{
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
yield return new WaitForSeconds(times);
|
|
|
ui.gameObject.SetActive(state);
|
|
|
}
|