This commit is contained in:
parent
3981b4930c
commit
754c0c46e6
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
|
@ -2,6 +2,7 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当前选择的区域
|
/// 当前选择的区域
|
||||||
|
@ -22,7 +23,8 @@ public enum Typeoffurniture
|
||||||
灯,//灯
|
灯,//灯
|
||||||
窗帘,//窗帘
|
窗帘,//窗帘
|
||||||
空调,//空调
|
空调,//空调
|
||||||
窗户//窗户
|
窗户,//窗户
|
||||||
|
电视//电视
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 点击后显示对应的UI
|
/// 点击后显示对应的UI
|
||||||
|
@ -54,6 +56,10 @@ public class ClickModelType : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GameObject AirPanel;
|
public GameObject AirPanel;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 电视控制面板
|
||||||
|
/// </summary>
|
||||||
|
public GameObject TvPanel;
|
||||||
|
/// <summary>
|
||||||
/// 当前区域类型
|
/// 当前区域类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Transform regionType;
|
public Transform regionType;
|
||||||
|
@ -82,13 +88,18 @@ public class ClickModelType : MonoBehaviour
|
||||||
}
|
}
|
||||||
public void OnMouseDown()
|
public void OnMouseDown()
|
||||||
{
|
{
|
||||||
|
if (EventSystem.current.IsPointerOverGameObject())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (SelectModel.Instance.region == region && typeoffurniture == Typeoffurniture.灯)
|
if (SelectModel.Instance.region == region && typeoffurniture == Typeoffurniture.灯)
|
||||||
{
|
{
|
||||||
Control_Light.Instance.LightsModel = new List<Transform>();
|
|
||||||
windowPanel.SetActive(false);
|
windowPanel.SetActive(false);
|
||||||
curtainPanel.SetActive(false);
|
curtainPanel.SetActive(false);
|
||||||
LightPanel.SetActive(true);
|
LightPanel.SetActive(true);
|
||||||
AirPanel.SetActive(false);
|
AirPanel.SetActive(false);
|
||||||
|
TvPanel.SetActive(false);
|
||||||
|
Control_Light.Instance.LightsModel = new List<Transform>();
|
||||||
List<ClickModelType> clickModelTypes = FindObjectsOfType<ClickModelType>().ToList();
|
List<ClickModelType> clickModelTypes = FindObjectsOfType<ClickModelType>().ToList();
|
||||||
for (int i = 0; i < clickModelTypes.Count; i++)
|
for (int i = 0; i < clickModelTypes.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -98,29 +109,41 @@ public class ClickModelType : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (SelectModel.Instance.region == region && typeoffurniture == Typeoffurniture.窗帘)
|
else if (SelectModel.Instance.region == region && typeoffurniture == Typeoffurniture.窗帘)
|
||||||
{
|
{
|
||||||
windowPanel.SetActive(false);
|
windowPanel.SetActive(false);
|
||||||
curtainPanel.SetActive(true);
|
curtainPanel.SetActive(true);
|
||||||
LightPanel.SetActive(false);
|
LightPanel.SetActive(false);
|
||||||
AirPanel.SetActive(false);
|
AirPanel.SetActive(false);
|
||||||
|
TvPanel.SetActive(false);
|
||||||
Control_Curtain.Instance.curtain = transform;
|
Control_Curtain.Instance.curtain = transform;
|
||||||
}
|
}
|
||||||
if (SelectModel.Instance.region == region && typeoffurniture == Typeoffurniture.窗户)
|
else if (SelectModel.Instance.region == region && typeoffurniture == Typeoffurniture.窗户)
|
||||||
{
|
{
|
||||||
|
Control_Windows.Instance.window = transform;
|
||||||
windowPanel.SetActive(true);
|
windowPanel.SetActive(true);
|
||||||
curtainPanel.SetActive(false);
|
curtainPanel.SetActive(false);
|
||||||
LightPanel.SetActive(false);
|
LightPanel.SetActive(false);
|
||||||
AirPanel.SetActive(false);
|
AirPanel.SetActive(false);
|
||||||
Control_Windows.Instance.window = transform;
|
TvPanel.SetActive(false);
|
||||||
}
|
}
|
||||||
if (SelectModel.Instance.region == region && typeoffurniture == Typeoffurniture.空调)
|
else if (SelectModel.Instance.region == region && typeoffurniture == Typeoffurniture.空调)
|
||||||
{
|
{
|
||||||
windowPanel.SetActive(false);
|
windowPanel.SetActive(false);
|
||||||
curtainPanel.SetActive(false);
|
curtainPanel.SetActive(false);
|
||||||
LightPanel.SetActive(false);
|
LightPanel.SetActive(false);
|
||||||
AirPanel.SetActive(true);
|
AirPanel.SetActive(true);
|
||||||
|
TvPanel.SetActive(false);
|
||||||
Control_Air.Instance.airobject = transform;
|
Control_Air.Instance.airobject = transform;
|
||||||
}
|
}
|
||||||
|
else if (SelectModel.Instance.region == region && typeoffurniture == Typeoffurniture.电视)
|
||||||
|
{
|
||||||
|
windowPanel.SetActive(false);
|
||||||
|
curtainPanel.SetActive(false);
|
||||||
|
LightPanel.SetActive(false);
|
||||||
|
AirPanel.SetActive(false);
|
||||||
|
TvPanel.SetActive(true);
|
||||||
|
Control_Tv.Instance.Tv = transform;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,11 @@ public class Control_Air : MonoBehaviour
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 制冷按钮
|
/// 制冷按钮
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Button Cool;
|
public Toggle Cool;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 制热按钮
|
/// 制热按钮
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Button Warm;
|
public Toggle Warm;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 温度+
|
/// 温度+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -42,12 +42,34 @@ public class Control_Air : MonoBehaviour
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否开启空调
|
/// 是否开启空调
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool isOpen;
|
bool isOpen = false;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 点击的空调
|
/// 点击的空调
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Transform airobject;
|
public Transform airobject;
|
||||||
|
/// <summary>
|
||||||
|
/// 空调的温度
|
||||||
|
/// </summary>
|
||||||
|
public TextMeshProUGUI airnumber;
|
||||||
|
/// <summary>
|
||||||
|
/// 空调模式
|
||||||
|
/// </summary>
|
||||||
|
public Toggle airwarmModel;
|
||||||
|
/// <summary>
|
||||||
|
/// 空调模式
|
||||||
|
/// </summary>
|
||||||
|
public Toggle airwcoolModel;
|
||||||
|
/// <summary>
|
||||||
|
/// 所有风速图片
|
||||||
|
/// </summary>
|
||||||
|
public List<Sprite> flyspeeds = new List<Sprite>();
|
||||||
|
/// <summary>
|
||||||
|
/// UI风速图片
|
||||||
|
/// </summary>
|
||||||
|
public Image flyspeed;
|
||||||
|
|
||||||
|
|
||||||
|
int indextflyspeed;
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
@ -56,17 +78,18 @@ public class Control_Air : MonoBehaviour
|
||||||
{
|
{
|
||||||
Open.onClick.AddListener(() =>
|
Open.onClick.AddListener(() =>
|
||||||
{
|
{
|
||||||
|
Cool.isOn = true;
|
||||||
isOpen = !isOpen;
|
isOpen = !isOpen;
|
||||||
OpenAir(isOpen);
|
OpenAir(isOpen);
|
||||||
});
|
});
|
||||||
Cool.onClick.AddListener(() =>
|
//Cool.onValueChanged.AddListener((a) =>
|
||||||
{
|
//{
|
||||||
OpenAir(true);
|
// OpenAir(true);
|
||||||
});
|
//});
|
||||||
Warm.onClick.AddListener(() =>
|
//Warm.onValueChanged.AddListener((a) =>
|
||||||
{
|
//{
|
||||||
SetWarm();
|
// SetWarm();
|
||||||
});
|
//});
|
||||||
TempAdd.onClick.AddListener(() =>
|
TempAdd.onClick.AddListener(() =>
|
||||||
{
|
{
|
||||||
AddTemp();
|
AddTemp();
|
||||||
|
@ -84,41 +107,91 @@ public class Control_Air : MonoBehaviour
|
||||||
SubWind();
|
SubWind();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/// <summary>
|
private void Update()
|
||||||
/// 打开空调 默认为制冷
|
|
||||||
/// </summary>
|
|
||||||
private void OpenAir(bool isopen)
|
|
||||||
{
|
{
|
||||||
if (isopen)
|
if (!isOpen)
|
||||||
{
|
{
|
||||||
Canvas chirendcanvas = airobject.GetComponentInChildren<Canvas>();
|
SetButtonClick(isOpen);
|
||||||
Open.GetComponentInChildren<TextMeshProUGUI>().text = "关闭空调";
|
|
||||||
chirendcanvas.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
|
|
||||||
List<TextMeshProUGUI> chirendmessage = chirendcanvas.GetComponentsInChildren<TextMeshProUGUI>().ToList();
|
|
||||||
airobject.GetChild(0).GetComponentInChildren<MeshRenderer>().material.EnableKeyword("_EMISSION");
|
|
||||||
chirendmessage[0].text = "16";//温度
|
|
||||||
chirendmessage[2].text = ">";//风速
|
|
||||||
chirendmessage[3].text = "制冷";//温度
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Canvas chirendcanvas = airobject.GetComponentInChildren<Canvas>();
|
SetButtonClick(isOpen);
|
||||||
Open.GetComponentInChildren<TextMeshProUGUI>().text = "打开空调";
|
|
||||||
chirendcanvas.transform.localScale = new Vector3(0, 0, 0);
|
|
||||||
airobject.GetChild(0).GetComponentInChildren<MeshRenderer>().material.DisableKeyword("_EMISSION");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void AudiosTalk(string Talk)
|
||||||
|
{
|
||||||
|
if (Talk.Contains("打开空调"))
|
||||||
|
{
|
||||||
|
isOpen = true;
|
||||||
|
OpenAir(isOpen);
|
||||||
|
}
|
||||||
|
else if (Talk.Contains("空调制冷"))
|
||||||
|
{
|
||||||
|
airwcoolModel.isOn = true;
|
||||||
|
OpenAir(true);
|
||||||
|
}
|
||||||
|
else if (Talk.Contains("空调制暖"))
|
||||||
|
{
|
||||||
|
airwarmModel.isOn = true;
|
||||||
|
SetWarm();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置按钮是否可点
|
||||||
|
/// </summary>
|
||||||
|
void SetButtonClick(bool isclick)
|
||||||
|
{
|
||||||
|
Warm.interactable = isclick;
|
||||||
|
Cool.interactable = isclick;
|
||||||
|
TempAdd.interactable = isclick;
|
||||||
|
TempSub.interactable = isclick;
|
||||||
|
WindAdd.interactable = isclick;
|
||||||
|
WindSub.interactable = isclick;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 打开空调 默认为制冷
|
||||||
|
/// </summary>
|
||||||
|
public void OpenAir(bool isopen)
|
||||||
|
{
|
||||||
|
if (airobject != null)
|
||||||
|
{
|
||||||
|
Canvas chirendcanvas = airobject.GetComponentInChildren<Canvas>();
|
||||||
|
if (isopen)
|
||||||
|
{
|
||||||
|
//Open.GetComponentInChildren<TextMeshProUGUI>().text = "关闭空调";
|
||||||
|
chirendcanvas.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
|
||||||
|
List<TextMeshProUGUI> chirendmessage = chirendcanvas.GetComponentsInChildren<TextMeshProUGUI>().ToList();
|
||||||
|
airobject.GetChild(0).GetComponentInChildren<MeshRenderer>().material.EnableKeyword("_EMISSION");
|
||||||
|
chirendmessage[0].text = "16";//温度
|
||||||
|
//chirendmessage[2].text = ">";//风速
|
||||||
|
chirendmessage[2].text = "制冷";//温度
|
||||||
|
airnumber.text = "16";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
//Open.GetComponentInChildren<TextMeshProUGUI>().text = "打开空调";
|
||||||
|
chirendcanvas.transform.localScale = new Vector3(0, 0, 0);
|
||||||
|
airobject.GetChild(0).GetComponentInChildren<MeshRenderer>().material.DisableKeyword("_EMISSION");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置制暖
|
/// 设置制暖
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void SetWarm()
|
public void SetWarm()
|
||||||
{
|
{
|
||||||
Canvas chirendcanvas = airobject.GetComponentInChildren<Canvas>();
|
if (airobject != null)
|
||||||
List<TextMeshProUGUI> chirendmessage = chirendcanvas.GetComponentsInChildren<TextMeshProUGUI>().ToList();
|
{
|
||||||
airobject.GetChild(0).GetComponentInChildren<MeshRenderer>().material.EnableKeyword("_EMISSION");
|
Canvas chirendcanvas = airobject.GetComponentInChildren<Canvas>();
|
||||||
chirendmessage[0].text = "26";
|
List<TextMeshProUGUI> chirendmessage = chirendcanvas.GetComponentsInChildren<TextMeshProUGUI>().ToList();
|
||||||
chirendmessage[2].text = ">";//风速
|
airobject.GetChild(0).GetComponentInChildren<MeshRenderer>().material.EnableKeyword("_EMISSION");
|
||||||
chirendmessage[3].text = "制热";//模式
|
chirendmessage[0].text = "26";
|
||||||
|
airnumber.text = "26";
|
||||||
|
//chirendmessage[2].text = ">";//风速
|
||||||
|
chirendmessage[2].text = "制热";//模式
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 温度+
|
/// 温度+
|
||||||
|
@ -131,6 +204,7 @@ public class Control_Air : MonoBehaviour
|
||||||
{
|
{
|
||||||
chirendmessage[0].text = (int.Parse(chirendmessage[0].text) + 1).ToString();
|
chirendmessage[0].text = (int.Parse(chirendmessage[0].text) + 1).ToString();
|
||||||
}
|
}
|
||||||
|
airnumber.text = chirendmessage[0].text;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 温度-
|
/// 温度-
|
||||||
|
@ -143,6 +217,7 @@ public class Control_Air : MonoBehaviour
|
||||||
{
|
{
|
||||||
chirendmessage[0].text = (int.Parse(chirendmessage[0].text) - 1).ToString();
|
chirendmessage[0].text = (int.Parse(chirendmessage[0].text) - 1).ToString();
|
||||||
}
|
}
|
||||||
|
airnumber.text = chirendmessage[0].text;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 风速+
|
/// 风速+
|
||||||
|
@ -150,11 +225,19 @@ public class Control_Air : MonoBehaviour
|
||||||
private void AddWind()
|
private void AddWind()
|
||||||
{
|
{
|
||||||
Canvas chirendcanvas = airobject.GetComponentInChildren<Canvas>();
|
Canvas chirendcanvas = airobject.GetComponentInChildren<Canvas>();
|
||||||
List<TextMeshProUGUI> chirendmessage = chirendcanvas.GetComponentsInChildren<TextMeshProUGUI>().ToList();
|
Image chirendmessage = chirendcanvas.GetComponentInChildren<Image>();
|
||||||
if (chirendmessage[2].text.Length < 3)
|
|
||||||
|
if (indextflyspeed < 2)
|
||||||
{
|
{
|
||||||
chirendmessage[2].text += ">";
|
indextflyspeed++;
|
||||||
|
flyspeed.sprite = flyspeeds[indextflyspeed];
|
||||||
|
chirendmessage.sprite = flyspeeds[indextflyspeed];
|
||||||
}
|
}
|
||||||
|
//List<TextMeshProUGUI> chirendmessage = chirendcanvas.GetComponentsInChildren<TextMeshProUGUI>().ToList();
|
||||||
|
//if (chirendmessage[2].text.Length < 3)
|
||||||
|
//{
|
||||||
|
// chirendmessage[2].text += ">";
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 风速-
|
/// 风速-
|
||||||
|
@ -162,10 +245,16 @@ public class Control_Air : MonoBehaviour
|
||||||
private void SubWind()
|
private void SubWind()
|
||||||
{
|
{
|
||||||
Canvas chirendcanvas = airobject.GetComponentInChildren<Canvas>();
|
Canvas chirendcanvas = airobject.GetComponentInChildren<Canvas>();
|
||||||
List<TextMeshProUGUI> chirendmessage = chirendcanvas.GetComponentsInChildren<TextMeshProUGUI>().ToList();
|
Image chirendmessage = chirendcanvas.GetComponentInChildren<Image>();
|
||||||
if (chirendmessage[2].text.Length > 1)
|
//if (chirendmessage[2].text.Length > 1)
|
||||||
|
//{
|
||||||
|
// chirendmessage[2].text = chirendmessage[2].text.Substring(0, chirendmessage[2].text.Length - 1);
|
||||||
|
//}
|
||||||
|
if (indextflyspeed > 0)
|
||||||
{
|
{
|
||||||
chirendmessage[2].text = chirendmessage[2].text.Substring(0, chirendmessage[2].text.Length - 1);
|
indextflyspeed--;
|
||||||
|
flyspeed.sprite = flyspeeds[indextflyspeed];
|
||||||
|
chirendmessage.sprite = flyspeeds[indextflyspeed];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,25 +31,34 @@ public class Control_Curtain : MonoBehaviour
|
||||||
// Opencurtains();
|
// Opencurtains();
|
||||||
//});
|
//});
|
||||||
}
|
}
|
||||||
public void Opencurtains()
|
private void Update()
|
||||||
{
|
{
|
||||||
Opencurtain();
|
//如果没在播放动画 则可以继续点击按钮
|
||||||
|
if (curtain != null && !curtain.GetComponent<Animation>().isPlaying)
|
||||||
|
{
|
||||||
|
Open.interactable = true;
|
||||||
|
Close.interactable = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void Opencurtains(bool isopen)
|
||||||
|
{
|
||||||
|
Open.interactable = false;
|
||||||
|
Close.interactable = false;
|
||||||
|
Opencurtain(isopen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 开关窗帘
|
/// 开关窗帘
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
void Opencurtain()
|
void Opencurtain(bool isopen)
|
||||||
{
|
{
|
||||||
if (curtain.GetComponent<SkinnedMeshRenderer>().GetBlendShapeWeight(0) == 0)
|
if (curtain.GetComponent<SkinnedMeshRenderer>().GetBlendShapeWeight(0) == 0&& !isopen)
|
||||||
{
|
{
|
||||||
Open.isOn = false;
|
|
||||||
curtain.GetComponent<Animation>().Play("窗帘开");
|
curtain.GetComponent<Animation>().Play("窗帘开");
|
||||||
}
|
}
|
||||||
else if (curtain.GetComponent<SkinnedMeshRenderer>().GetBlendShapeWeight(0) == 100)
|
else if (curtain.GetComponent<SkinnedMeshRenderer>().GetBlendShapeWeight(0) == 100&& isopen)
|
||||||
{
|
{
|
||||||
Open.isOn = true;
|
|
||||||
curtain.GetComponent<Animation>().Play("窗帘关");
|
curtain.GetComponent<Animation>().Play("窗帘关");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,25 @@ public class Control_Light : MonoBehaviour
|
||||||
// AudiosContorl(listenFeild.text);
|
// AudiosContorl(listenFeild.text);
|
||||||
//});
|
//});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
if (Is_Open)
|
||||||
|
{
|
||||||
|
IsClick(Is_Open);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IsClick(Is_Open);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void IsClick(bool isclick)
|
||||||
|
{
|
||||||
|
Incandescent.interactable = isclick;
|
||||||
|
cool.interactable = isclick;
|
||||||
|
warm.interactable = isclick;
|
||||||
|
Lightbrightness.interactable = isclick;
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 语音控制
|
/// 语音控制
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -83,10 +102,14 @@ public class Control_Light : MonoBehaviour
|
||||||
{
|
{
|
||||||
if (str.Contains("开灯"))
|
if (str.Contains("开灯"))
|
||||||
{
|
{
|
||||||
|
Is_Open = true;
|
||||||
|
IsClick(Is_Open);
|
||||||
OpenorCloseLight(true);
|
OpenorCloseLight(true);
|
||||||
}
|
}
|
||||||
else if (str.Contains("关灯"))
|
else if (str.Contains("关灯"))
|
||||||
{
|
{
|
||||||
|
Is_Open = false;
|
||||||
|
IsClick(Is_Open);
|
||||||
OpenorCloseLight(false);
|
OpenorCloseLight(false);
|
||||||
}
|
}
|
||||||
else if (str.Contains("暖光"))
|
else if (str.Contains("暖光"))
|
||||||
|
|
|
@ -31,21 +31,30 @@ public class Control_Windows : MonoBehaviour
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
if (window != null )
|
||||||
|
{
|
||||||
|
if (window.GetComponent<SkinnedMeshRenderer>().GetBlendShapeWeight(0) == 0 || window.GetComponent<SkinnedMeshRenderer>().GetBlendShapeWeight(0) == 100)
|
||||||
|
{
|
||||||
|
open.interactable = true;
|
||||||
|
close.interactable = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void Openwindows()
|
public void Openwindows(bool isopen)
|
||||||
{
|
{
|
||||||
StartCoroutine(Openwindow());
|
open.interactable = false;
|
||||||
|
close.interactable = false;
|
||||||
|
StartCoroutine(Openwindow(isopen));
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ¿ª¹Ø´°»§
|
/// ¿ª¹Ø´°»§
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
IEnumerator Openwindow()
|
IEnumerator Openwindow(bool isopen)
|
||||||
{
|
{
|
||||||
if (window.GetComponent<SkinnedMeshRenderer>().GetBlendShapeWeight(0) == 0)
|
|
||||||
|
if (window.GetComponent<SkinnedMeshRenderer>().GetBlendShapeWeight(0) == 0 && isopen)
|
||||||
{
|
{
|
||||||
close.isOn = false;
|
|
||||||
//openwindows.GetComponentInChildren<TextMeshProUGUI>().text = "¹Ø´°";
|
//openwindows.GetComponentInChildren<TextMeshProUGUI>().text = "¹Ø´°";
|
||||||
for (int i = 1; i < 101; i++)
|
for (int i = 1; i < 101; i++)
|
||||||
{
|
{
|
||||||
|
@ -53,9 +62,8 @@ public class Control_Windows : MonoBehaviour
|
||||||
yield return new WaitForSeconds(0.025f);
|
yield return new WaitForSeconds(0.025f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (window.GetComponent<SkinnedMeshRenderer>().GetBlendShapeWeight(0) == 100)
|
else if (window.GetComponent<SkinnedMeshRenderer>().GetBlendShapeWeight(0) == 100 && !isopen)
|
||||||
{
|
{
|
||||||
open.isOn = false;
|
|
||||||
//openwindows.GetComponentInChildren<TextMeshProUGUI>().text = "¿ª´°";
|
//openwindows.GetComponentInChildren<TextMeshProUGUI>().text = "¿ª´°";
|
||||||
for (int i = 100; i >= 0; i--)
|
for (int i = 100; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,6 +63,7 @@ public class SpeechToText : MonoBehaviour
|
||||||
Debug.Log($"讯飞语音转文本成功!文本为:{text}");
|
Debug.Log($"讯飞语音转文本成功!文本为:{text}");
|
||||||
//GetSpeechText = text;
|
//GetSpeechText = text;
|
||||||
Control_Light.Instance.AudiosContorl(text);
|
Control_Light.Instance.AudiosContorl(text);
|
||||||
|
Control_Air.Instance.AudiosTalk(text);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue