2025-02-12 08:43:33 +08:00

168 lines
6.8 KiB
C#

using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using ZXK.Framework;
using ZXK.UTility;
namespace ZXK.BYSS {
public class JiaoXueYinDaoBtn : UIBase
{
public Button _JiaoXueYinDaoBtn;
public Transform _videoTran;
protected override void Awake()
{
base.Awake();
}
private void Start()
{
//教学引导视频播放
//UI事件注册
if (AppManagement.Instance._CurModel == EnumCtrl.Model.Teach)
{
//搬运输送显示不同的教学引导按钮
if (AppManagement.Instance._CurType==EnumCtrl.Type.BYSS)
{
//5个模块教学引导
//设备组装,设备接线,程序下载,设备充气,设备运行
GetWedage("ByssJiaoXue1_N").transform.gameObject.SetActive(true);
GetWedage("ByssJiaoXue2_N").transform.gameObject.SetActive(true);
GetWedage("ByssJiaoXue3_N").transform.gameObject.SetActive(true);
GetWedage("ByssJiaoXue4_N").transform.gameObject.SetActive(true);
GetWedage("ByssJiaoXue5_N").transform.gameObject.SetActive(true);
GetWedage("JiaoXueYinDaoBtn_N").gameObject.SetActive(false);
//视频界面
Transform top = GameObject.FindGameObjectWithTag("MainCanvas").transform.parent.Find("TopCanvas");
UIBase vcrPanel = UI_Manage.Instance.ShowPanel("VCRPanel", -1, top);
_videoTran = vcrPanel.gameObject.transform;
_videoTran.gameObject.SetActive(false);
_videoTran.localScale = Vector3.zero;
AddEventListener("ByssJiaoXue1_N", UIEventType.OnButtonClick,()=> {
_videoTran.DOScale(1.0f, 0.5f);
_videoTran.gameObject.SetActive(true);
string _videoPath = Application.streamingAssetsPath + ConstCtrl.VIDEO_BYSS1_PATH;
_videoTran.GetComponent<VCRCustom>().OnOpenVideoFile(_videoPath);
});
AddEventListener("ByssJiaoXue2_N", UIEventType.OnButtonClick,()=> {
_videoTran.DOScale(1.0f, 0.5f);
_videoTran.gameObject.SetActive(true);
string _videoPath = Application.streamingAssetsPath + ConstCtrl.VIDEO_BYSS2_PATH;
_videoTran.GetComponent<VCRCustom>().OnOpenVideoFile(_videoPath);
});
AddEventListener("ByssJiaoXue3_N", UIEventType.OnButtonClick,()=> {
_videoTran.DOScale(1.0f, 0.5f);
_videoTran.gameObject.SetActive(true);
string _videoPath = Application.streamingAssetsPath + ConstCtrl.VIDEO_BYSS3_PATH;
_videoTran.GetComponent<VCRCustom>().OnOpenVideoFile(_videoPath);
});
AddEventListener("ByssJiaoXue4_N", UIEventType.OnButtonClick,()=> {
_videoTran.DOScale(1.0f, 0.5f);
_videoTran.gameObject.SetActive(true);
string _videoPath = Application.streamingAssetsPath + ConstCtrl.VIDEO_BYSS4_PATH;
_videoTran.GetComponent<VCRCustom>().OnOpenVideoFile(_videoPath);
});
AddEventListener("ByssJiaoXue5_N", UIEventType.OnButtonClick,()=> {
_videoTran.DOScale(1.0f, 0.5f);
_videoTran.gameObject.SetActive(true);
string _videoPath = Application.streamingAssetsPath + ConstCtrl.VIDEO_BYSS5_PATH;
_videoTran.GetComponent<VCRCustom>().OnOpenVideoFile(_videoPath);
});
}
else
{
GetWedage("ByssJiaoXue1_N").transform.gameObject.SetActive(false);
GetWedage("ByssJiaoXue2_N").transform.gameObject.SetActive(false);
GetWedage("ByssJiaoXue3_N").transform.gameObject.SetActive(false);
GetWedage("ByssJiaoXue4_N").transform.gameObject.SetActive(false);
GetWedage("ByssJiaoXue5_N").transform.gameObject.SetActive(false);
_JiaoXueYinDaoBtn = GetWedage("JiaoXueYinDaoBtn_N").transform.GetComponent<Button>();
_JiaoXueYinDaoBtn.gameObject.SetActive(true);
//TODO
//暂时用教学引导按钮
Transform top = GameObject.FindGameObjectWithTag("MainCanvas").transform.parent.Find("TopCanvas");
//视频界面
UIBase vcrPanel = UI_Manage.Instance.ShowPanel("VCRPanel", -1, top);
_videoTran = vcrPanel.gameObject.transform;
_videoTran.gameObject.SetActive(false);
_videoTran.localScale = Vector3.zero;
//教学引导按钮添加播放视频功能
AddEventListener("JiaoXueYinDaoBtn_N", UIEventType.OnButtonClick, () =>
{
_videoTran.DOScale(1.0f, 0.5f);
_videoTran.gameObject.SetActive(true);
//TODO
//根据模式给不同的视频地址
string _videoPath;
_videoPath = Application.streamingAssetsPath + ConstCtrl.VIDEO_CLFJ_PATH;
switch (AppManagement.Instance._CurType)
{
case EnumCtrl.Type.XHBY:
_videoPath = Application.streamingAssetsPath + ConstCtrl.VIDEO_XHBY_PATH;
break;
case EnumCtrl.Type.QDCY:
_videoPath = Application.streamingAssetsPath + ConstCtrl.VIDEO_QDCY_PATH;
break;
case EnumCtrl.Type.CLFJ:
_videoPath = Application.streamingAssetsPath + ConstCtrl.VIDEO_CLFJ_PATH;
break;
case EnumCtrl.Type.ZNYD:
_videoPath = Application.streamingAssetsPath + ConstCtrl.VIDEO_ZNYD_PATH;
break;
}
_videoTran.GetComponent<VCRCustom>().OnOpenVideoFile(_videoPath);
});
}
}
else
{
//_JiaoXueYinDaoBtn = GetWedage("JiaoXueYinDaoBtn_N").GetComponent<Button>();
//_JiaoXueYinDaoBtn.gameObject.SetActive(false);
}
}
}
}