This commit is contained in:
lujiajian 2025-01-20 17:14:33 +08:00
parent 54fd8a2094
commit e3789081ab
6 changed files with 4839 additions and 1263 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -17,16 +17,19 @@ public class Control_Curtain : MonoBehaviour
/// 点击的窗帘 /// 点击的窗帘
/// </summary> /// </summary>
public Transform curtain; public Transform curtain;
public Toggle Open;
public Toggle Close;
private void Awake() private void Awake()
{ {
Instance = this; Instance = this;
} }
void Start() void Start()
{ {
opencurtain.onClick.AddListener(() => //opencurtain.onClick.AddListener(() =>
{ //{
Opencurtains(); // Opencurtains();
}); //});
} }
public void Opencurtains() public void Opencurtains()
{ {
@ -39,15 +42,14 @@ public class Control_Curtain : MonoBehaviour
/// <returns></returns> /// <returns></returns>
void Opencurtain() void Opencurtain()
{ {
if (curtain.GetComponent<SkinnedMeshRenderer>().GetBlendShapeWeight(0) == 0) if (curtain.GetComponent<SkinnedMeshRenderer>().GetBlendShapeWeight(0) == 0)
{ {
opencurtain.GetComponentInChildren<TextMeshProUGUI>().text = "À­¿ª´°Á±"; 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)
{ {
opencurtain.GetComponentInChildren<TextMeshProUGUI>().text = "À­Æð´°Á±"; Open.isOn = true;
curtain.GetComponent<Animation>().Play("窗帘关"); curtain.GetComponent<Animation>().Play("窗帘关");
} }
} }

View File

@ -33,9 +33,13 @@ public class Control_Light : MonoBehaviour
/// <summary> /// <summary>
/// ³õʼ·¢É¢ÑÕÉ« /// ³õʼ·¢É¢ÑÕÉ«
/// </summary> /// </summary>
private Color InitColor = new Color(1, 1,1); private Color InitColor = new Color(1, 1, 1);
public TMP_InputField listenFeild; public TMP_InputField listenFeild;
public Button enter; public Button enter;
public Toggle cool;
public Toggle warm;
public Toggle Incandescent;
private void Awake() private void Awake()
{ {
Instance = this; Instance = this;
@ -129,7 +133,7 @@ public class Control_Light : MonoBehaviour
{ {
if (IsOpen) if (IsOpen)
{ {
Open.transform.GetComponentInChildren<TextMeshProUGUI>().text = "šŘ"; //Open.transform.GetComponentInChildren<TextMeshProUGUI>().text = "¹Ø";
for (int i = 0; i < LightsModel.Count; i++) for (int i = 0; i < LightsModel.Count; i++)
{ {
Material material = LightsModel[i].GetComponent<MeshRenderer>().materials[0]; Material material = LightsModel[i].GetComponent<MeshRenderer>().materials[0];
@ -140,7 +144,7 @@ public class Control_Light : MonoBehaviour
} }
else else
{ {
Open.transform.GetComponentInChildren<TextMeshProUGUI>().text = "żŞ"; //Open.transform.GetComponentInChildren<TextMeshProUGUI>().text = "¿ª";
for (int i = 0; i < LightsModel.Count; i++) for (int i = 0; i < LightsModel.Count; i++)
{ {
Material material = LightsModel[i].GetComponent<MeshRenderer>().materials[0]; Material material = LightsModel[i].GetComponent<MeshRenderer>().materials[0];
@ -155,7 +159,8 @@ public class Control_Light : MonoBehaviour
/// </summary> /// </summary>
public void Coollight() public void Coollight()
{ {
warm.isOn = false;
Incandescent.isOn = false;
InitColor = new Color(0, 0.6145419f, 0.9433962f); InitColor = new Color(0, 0.6145419f, 0.9433962f);
for (int i = 0; i < LightsModel.Count; i++) for (int i = 0; i < LightsModel.Count; i++)
{ {
@ -168,6 +173,8 @@ public class Control_Light : MonoBehaviour
/// </summary> /// </summary>
public void Warmlight() public void Warmlight()
{ {
cool.isOn = false;
Incandescent.isOn = false;
InitColor = new Color(1, 0.6831585f, 0); InitColor = new Color(1, 0.6831585f, 0);
for (int i = 0; i < LightsModel.Count; i++) for (int i = 0; i < LightsModel.Count; i++)
{ {
@ -180,6 +187,8 @@ public class Control_Light : MonoBehaviour
/// </summary> /// </summary>
public void Incandescentlight() public void Incandescentlight()
{ {
cool.isOn = false;
warm.isOn = false;
InitColor = new Color(1, 1, 1); InitColor = new Color(1, 1, 1);
for (int i = 0; i < LightsModel.Count; i++) for (int i = 0; i < LightsModel.Count; i++)
{ {

View File

@ -12,18 +12,21 @@ public class Control_Windows : MonoBehaviour
/// <summary> /// <summary>
/// ¿ª/¹Ø´°»§ /// ¿ª/¹Ø´°»§
/// </summary> /// </summary>
public Button openwindows; //public Button openwindows;
/// <summary> /// <summary>
/// µã»÷µÄ´°»§ /// µã»÷µÄ´°»§
/// </summary> /// </summary>
public Transform window; public Transform window;
public Toggle open;
public Toggle close;
private void Awake() private void Awake()
{ {
Instance = this; Instance = this;
} }
void Start() void Start()
{ {
openwindows.onClick.AddListener(() => { Openwindows(); }); //openwindows.onClick.AddListener(() => { Openwindows(); });
} }
// Update is called once per frame // Update is called once per frame
void Update() void Update()
@ -42,7 +45,8 @@ public class Control_Windows : MonoBehaviour
{ {
if (window.GetComponent<SkinnedMeshRenderer>().GetBlendShapeWeight(0) == 0) if (window.GetComponent<SkinnedMeshRenderer>().GetBlendShapeWeight(0) == 0)
{ {
openwindows.GetComponentInChildren<TextMeshProUGUI>().text = "关窗"; close.isOn = false;
//openwindows.GetComponentInChildren<TextMeshProUGUI>().text = "¹Ø´°";
for (int i = 1; i < 101; i++) for (int i = 1; i < 101; i++)
{ {
window.GetComponent<SkinnedMeshRenderer>().SetBlendShapeWeight(0, i); window.GetComponent<SkinnedMeshRenderer>().SetBlendShapeWeight(0, i);
@ -51,7 +55,8 @@ public class Control_Windows : MonoBehaviour
} }
else if (window.GetComponent<SkinnedMeshRenderer>().GetBlendShapeWeight(0) == 100) else if (window.GetComponent<SkinnedMeshRenderer>().GetBlendShapeWeight(0) == 100)
{ {
openwindows.GetComponentInChildren<TextMeshProUGUI>().text = "开窗"; open.isOn = false;
//openwindows.GetComponentInChildren<TextMeshProUGUI>().text = "¿ª´°";
for (int i = 100; i >= 0; i--) for (int i = 100; i >= 0; i--)
{ {
window.GetComponent<SkinnedMeshRenderer>().SetBlendShapeWeight(0, i); window.GetComponent<SkinnedMeshRenderer>().SetBlendShapeWeight(0, i);

View File

@ -1,3 +1,4 @@
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
@ -5,19 +6,43 @@ using UnityEngine.UI;
public class PlayImage : MonoBehaviour public class PlayImage : MonoBehaviour
{ {
public static PlayImage Instance;
public Sprite[] sprites; // 存储序列帧动画的所有帧 public Sprite[] sprites; // 存储序列帧动画的所有帧
public float framesPerSecond = 10.0f; // 每秒播放的帧数 public float framesPerSecond = 10.0f; // 每秒播放的帧数
private float index = 0;
private int imageindex = 0;
public Image image; public Image image;
bool isPlay = false;
// Start is called before the first frame update // Start is called before the first frame update
void Start() private void Update()
{ {
StartCoroutine(PlaySprites()); if (isPlay)
{
index += 0.3f;
if (index >= framesPerSecond)
{
imageindex++;
index = 0;
if (imageindex >= sprites.Length)
{
imageindex = 0;
}
image.sprite = sprites[imageindex];
}
}
else
{
image.sprite = sprites[0];
}
} }
public void PlayImager()
IEnumerator PlaySprites()
{ {
while (true) isPlay = !isPlay;
}
IEnumerator PlaySprites(bool isPlay)
{
while (isPlay)
{ {
for (int i = 0; i < sprites.Length; i++) for (int i = 0; i < sprites.Length; i++)
{ {