347 lines
13 KiB
C#
347 lines
13 KiB
C#
using DG.Tweening;
|
||
using HighlightPlus;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using UnityEngine;
|
||
|
||
public class ChangeObjMat : MonoBehaviour
|
||
{
|
||
public Material m_TM;
|
||
public List<MeshRenderer> m_RendererList;
|
||
private List<List<Material>> m_RecordRendererList = new List<List<Material>>();
|
||
/// <summary>
|
||
/// 车辆物体
|
||
/// </summary>
|
||
public GameObject m_Obj;
|
||
/// <summary>
|
||
/// 车辆线框
|
||
/// </summary>
|
||
public GameObject m_XKObj;
|
||
/// <summary>
|
||
/// 车牌扫描
|
||
/// </summary>
|
||
public GameObject m_CPObj;
|
||
/// <summary>
|
||
/// 车身扫描
|
||
/// </summary>
|
||
public GameObject m_CSSMObj;
|
||
/// <summary>
|
||
/// 红外扫描
|
||
/// </summary>
|
||
public GameObject m_HWSMObj;
|
||
/// <summary>
|
||
/// 紫外扫描
|
||
/// </summary>
|
||
public GameObject m_ZWSMObj;
|
||
/// <summary>
|
||
/// 声纹扫描
|
||
/// </summary>
|
||
public GameObject m_SWSMObj;
|
||
/// <summary>
|
||
/// 声纹检测
|
||
/// </summary>
|
||
public GameObject m_SWJCObj;
|
||
/// <summary>
|
||
/// 电池检测
|
||
/// </summary>
|
||
public GameObject m_DCJCObj;
|
||
/// <summary>
|
||
/// 预约均衡
|
||
/// </summary>
|
||
public GameObject m_JHJCObj;
|
||
/// <summary>
|
||
/// 电池高亮
|
||
/// </summary>
|
||
public HighlightEffect m_HighlightEffect;
|
||
/// <summary>
|
||
/// 充电口高亮
|
||
/// </summary>
|
||
public HighlightEffect m_Highlight;
|
||
/// <summary>
|
||
/// 充电特效
|
||
/// </summary>
|
||
public GameObject[] m_effectObj;
|
||
/// <summary>
|
||
/// 充电枪
|
||
/// </summary>
|
||
public GameObject m_gunObj;
|
||
|
||
void Start()
|
||
{
|
||
m_RendererList = GetComponentsInChildren<MeshRenderer>().ToList();
|
||
m_RecordRendererList.Clear();
|
||
for (int i = 0; i < m_RendererList.Count; i++)
|
||
{
|
||
m_RecordRendererList.Add(m_RendererList[i].materials.ToList());
|
||
}
|
||
if (Bootstrap.Instance != null) Bootstrap.Instance.eventCenter.AddEventListener<bool>(Enum_EventType.ChangeChildrenMat, ChangeChildrenMat);
|
||
if (Bootstrap.Instance != null) Bootstrap.Instance.eventCenter.AddEventListener(Enum_EventType.StepSwitching, StepSwitching);
|
||
ChangeChildrenMat(true);
|
||
//StepSwitching();
|
||
}
|
||
public void ChangeChildrenMat(bool Change)
|
||
{
|
||
if (Change)
|
||
{
|
||
for (int i = 0; i < m_RendererList.Count; i++)
|
||
{
|
||
int len = m_RendererList[i].materials.Length;
|
||
Material[] matArr = new Material[len];
|
||
for (int j = 0; j < len; j++)
|
||
{
|
||
matArr[j] = m_TM;
|
||
}
|
||
for (int j = 0; j < len; j++)
|
||
{
|
||
m_RendererList[i].materials = matArr;
|
||
}
|
||
|
||
}
|
||
}
|
||
else
|
||
{
|
||
for (int i = 0; i < m_RecordRendererList.Count; i++)
|
||
{
|
||
List<Material> materialList = m_RecordRendererList[i];
|
||
|
||
m_RendererList[i].materials = materialList.ToArray();
|
||
}
|
||
}
|
||
|
||
}
|
||
public void StepSwitching()
|
||
{
|
||
StartCoroutine(StepSwitchingCoroutine());
|
||
}
|
||
|
||
IEnumerator StepSwitchingCoroutine()
|
||
{
|
||
|
||
|
||
Debug.Log("StepSwitchingCoroutine");
|
||
#region 车辆入场
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"您的爱车已入场!", 3);
|
||
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.AudioPlay, $"车辆入场");
|
||
});
|
||
yield return new WaitForSeconds(3);
|
||
#endregion
|
||
#region 车牌识别
|
||
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.AudioPlay, $"车牌识别");
|
||
m_XKObj.SetActive(true);
|
||
m_Obj.SetActive(false);
|
||
m_CPObj.SetActive(true);
|
||
yield return new WaitForSeconds(5);
|
||
m_CPObj.SetActive(false);
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"检测到车牌号为" + GetawayMqttClient.licensePlateData.LicensePlateNumber + "!", 5);
|
||
});
|
||
WebViewController.Instance.CallGetButtonClickWithCode("车牌识别");
|
||
yield return new WaitForSeconds(6);
|
||
#endregion
|
||
#region 插枪操作
|
||
m_Highlight.SetHighlighted(true);
|
||
transform.parent.DOLocalRotate(new Vector3(-90, 0, -320), 5);
|
||
yield return new WaitForSeconds(5);
|
||
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.AudioPlay, $"插枪操作");
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"1.请插入充电枪!", 0);
|
||
});
|
||
|
||
Material[] tmpMat = m_gunObj.GetComponent<MeshRenderer>().materials;
|
||
for (int i = 0; i < tmpMat.Length; i++)
|
||
{
|
||
tmpMat[i].DOFade(1, 2);
|
||
}
|
||
yield return new WaitForSeconds(2);
|
||
m_gunObj.GetComponent<DOTweenAnimation>().DOPlayById("Gun");
|
||
yield return new WaitForSeconds(2);
|
||
m_Highlight.SetHighlighted(false);
|
||
m_gunObj.SetActive(false);
|
||
for (int i = 0; i < m_effectObj.Length; i++)
|
||
{
|
||
m_effectObj[i].SetActive(true);
|
||
}
|
||
yield return new WaitForSeconds(3);
|
||
for (int i = 0; i < tmpMat.Length; i++)
|
||
{
|
||
tmpMat[i].DOFade(0, 2);
|
||
}
|
||
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.AudioPlay, $"一键检测");
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"2.您的爱车现已进行充电检测,请进行一键检测操作并在大屏幕上查看检测情况!", 5);
|
||
});
|
||
yield return new WaitUntil(() => Input.GetKeyDown(KeyCode.Space));
|
||
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.CanRotate);
|
||
#endregion
|
||
#region 电池检测
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"均衡一体机检测准备:1.电池检测已开始!", 5);
|
||
});
|
||
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.AudioPlay, $"电池检测");
|
||
yield return new WaitForSeconds(5);
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"2.您的爱车正进行电池检测...", 10);
|
||
});
|
||
m_HighlightEffect.SetHighlighted(true);
|
||
m_DCJCObj.SetActive(true);////
|
||
yield return new WaitForSeconds(11);
|
||
m_DCJCObj.SetActive(false);////
|
||
m_HighlightEffect.SetHighlighted(false);
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"3.电池检测已完成!", 3);
|
||
});
|
||
yield return new WaitForSeconds(4);
|
||
#endregion
|
||
#region 车身外观检测
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"现在进入车身外观检测环节1.深度检测已开始!", 5);
|
||
});
|
||
yield return new WaitForSeconds(5);
|
||
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.AudioPlay, $"车身外观检测");
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"2.车外观检测开始!", 3);
|
||
});
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.GetPanel<UI_BGPanel>().OnLoadCSVideo();
|
||
yield return new WaitForSeconds(3);
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"3.您的爱车正进行车外观检测...", 10);
|
||
});
|
||
m_CSSMObj.SetActive(true);
|
||
yield return new WaitForSeconds(11);
|
||
m_CSSMObj.SetActive(false);
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"车外观检测已完成!", 5);
|
||
});
|
||
yield return new WaitForSeconds(6);
|
||
#endregion
|
||
#region 红外实时探测
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"车辆即将进行红外实时探测:1.红外检测已开始!", 3);
|
||
});
|
||
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.AudioPlay, $"红外实时探测");
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.GetPanel<UI_BGPanel>().OnLoadHWVideo();
|
||
yield return new WaitForSeconds(3);
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"2.您的爱车正进行红外检测...", 10);
|
||
});
|
||
m_HighlightEffect.SetHighlighted(true);
|
||
m_HWSMObj.SetActive(true);////
|
||
yield return new WaitForSeconds(11);
|
||
m_HWSMObj.SetActive(false);////
|
||
m_HighlightEffect.SetHighlighted(false);
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"3.红外检测已完成!", 5);
|
||
});
|
||
yield return new WaitForSeconds(6);
|
||
#endregion
|
||
#region 紫外实时探测
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"车辆即将进行紫外实时探测:1.紫外检测已开始!", 3);
|
||
});
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.GetPanel<UI_BGPanel>().OnLoadZWVideo();
|
||
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.AudioPlay, $"紫外实时探测");
|
||
yield return new WaitForSeconds(3);
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"2.您的爱车正进行紫外检测...", 10);
|
||
});
|
||
m_HighlightEffect.SetHighlighted(true);
|
||
m_ZWSMObj.SetActive(true);////
|
||
yield return new WaitForSeconds(11);
|
||
m_ZWSMObj.SetActive(false);////
|
||
m_HighlightEffect.SetHighlighted(false);
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"3.紫外检测已完成!", 5);
|
||
});
|
||
yield return new WaitForSeconds(6);
|
||
#endregion
|
||
#region 声纹检测
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"车辆进行声纹检测:1.声纹检测已开始!", 3);
|
||
});
|
||
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.AudioPlay, $"声纹检测");
|
||
yield return new WaitForSeconds(3);
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"2.您的爱车正进行声纹检测...", 10);
|
||
});
|
||
m_SWSMObj.SetActive(true);////
|
||
m_SWJCObj.SetActive(true);////
|
||
yield return new WaitForSeconds(11);
|
||
m_SWJCObj.SetActive(false);////
|
||
m_SWSMObj.SetActive(false);////
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"3.声纹观检测已完成!", 5);
|
||
});
|
||
yield return new WaitForSeconds(6);
|
||
#endregion
|
||
#region 深度检测报告
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"4.深度检测已完成!", 5);
|
||
});
|
||
yield return new WaitForSeconds(6);
|
||
if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"5.深度检测报告已生成,请扫描屏幕右下角的二维码获取!", 30);
|
||
});
|
||
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.AudioPlay, $"电池诊所检测全流程已完成");
|
||
m_XKObj.SetActive(false);
|
||
m_Obj.SetActive(true);
|
||
WebViewController.Instance.CallGetButtonClickWithCode("二维码");
|
||
//UI_BGPanel.btn_h51.gameObject.SetActive(true);
|
||
yield return new WaitForSeconds(31);
|
||
#endregion
|
||
#region 预约均衡
|
||
/* if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"您已预约电池均衡操作,请稍等...", 30);
|
||
});
|
||
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.AudioPlay, $"预约均衡");
|
||
m_HighlightEffect.SetHighlighted(true);
|
||
m_JHJCObj.SetActive(true);
|
||
yield return new WaitForSeconds(31);
|
||
m_JHJCObj.SetActive(false);
|
||
m_HighlightEffect.SetHighlighted(false);*/
|
||
#endregion
|
||
#region 均衡报告
|
||
/* if (Bootstrap.UIMgr != null) Bootstrap.UIMgr.ShowPanel<UI_MiddleTipPanel>(this, E_UI_Layer.Top, (p) =>
|
||
{
|
||
p.Init($"电池均衡操作已完成,请扫描屏幕右下角的二维码获取\n均衡报告!感谢您的支持和配合,祝您一路平安!", 0);
|
||
});
|
||
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.AudioPlay, $"电池诊所检测及均衡全流程已完成");
|
||
m_XKObj.SetActive(false);
|
||
m_Obj.SetActive(true);
|
||
//UI_BGPanel.btn_h52.gameObject.SetActive(true);*/
|
||
#endregion
|
||
}
|
||
private void OnDisable()
|
||
{
|
||
if (Bootstrap.Instance != null)
|
||
{
|
||
Bootstrap.Instance.eventCenter.RemoveEventListener<bool>(Enum_EventType.ChangeChildrenMat, ChangeChildrenMat);
|
||
Bootstrap.Instance.eventCenter.RemoveEventListener(Enum_EventType.StepSwitching, StepSwitching);
|
||
}
|
||
}
|
||
}
|