Tz2/Assets/Zion/Scripts/ERP/到货验收/ljj/ClickModel.cs

200 lines
7.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using DefaultNamespace.ProcessMode;
using DG.Tweening;
using HighlightPlus;
using System.Collections;
using DefaultNamespace;
using MotionFramework;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using UnityStandardAssets.Characters.FirstPerson;
using static InterfaceManager;
public enum ModelType
{
None,
,
,
,
,
,
}
public class ClickModel : MonoBehaviour
{
public ModelType modelType = ModelType.None;
// 最大检测距离默认设置为100
private float maxDistance = 100f;
/// <summary>
/// 高亮插件
/// </summary>
private HighlightEffect highlightEffect;
private Framework.Dto.InventoryReversalVoucherAnalyzer returnRevVoucherAnalyzer;
/// <summary>
/// 安全帽箭头
/// </summary>
public GameObject HatArror;
void Start()
{
//if ((!MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("库存物资报废") || !MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("废旧物资入库")) && modelType == ModelType.地磅 || modelType == ModelType.称重显示屏)
//{
// GetComponent<MeshCollider>().enabled = false;
// GetComponent<ClickModel>().enabled = false;
//}
highlightEffect = GetComponent<HighlightEffect>();
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "审核合同变更申请")
{
returnRevVoucherAnalyzer = (Framework.Dto.InventoryReversalVoucherAnalyzer)MotionEngine.GetModule<GlobalDataStorage>().materialTaskObj;
}
}
public void OnMouseDown()
{
if (EventSystem.current.IsPointerOverGameObject()) //鼠标在UI上
return;
switch (modelType)
{
case ModelType.None:
break;
case ModelType.:
if (ModerController.Instance.isWearingSafetyHat)
return;
HatArror.SetActive(false);
gameObject.SetActive(false);
UI_Tips.instance.ShowPanel("安全帽佩戴成功!");
ModerController.Instance.isWearingSafetyHat = true;
//领取并佩戴安全帽
MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick("安全帽");
if (highlightEffect != null)
{
highlightEffect.SetHighlighted(false);
}
LoadTriggerNextGuide();
break;
case ModelType.:
if (ModerController.Instance.iscomputer)
return;
// if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "不良行为处理")
// { MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick("电脑组");
// ModerController.Instance.iscomputer = true;
//
// }else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "违约索赔")
// { MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick("电脑组");
// ModerController.Instance.iscomputer = true;
// }
// else
// {
UI_Tips.instance.ShowPanel("电脑内网系统正常,键盘鼠标硬件正常!");
ModerController.Instance.iscomputer = true;
//领取并佩戴安全帽
MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick("电脑组");
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "审核合同变更申请")
{
if (returnRevVoucherAnalyzer.formselection == "合同1")
{
FileComponent.DownloadSingleFile("附件1-合同变更申请_合同1.xlsx");
}
else
{
FileComponent.DownloadSingleFile("附件1-合同变更申请_合同2.xlsx");
}
}
if (highlightEffect != null)
{
highlightEffect.SetHighlighted(false);
}
// }
LoadTriggerNextGuide(transform.name);
break;
case ModelType.:
//if (GetComponent<MeshCollider>().enabled == false&& MotionEngine.GetModule<ProcessManager>()._currentMode != ProcessMode.考核模式)
// return;
if (!WeighBridgeCheck.instance.isCheckWeigh)
{
UI_Tips.instance.ShowPanel("地磅检查成功!", true);
highlightEffect.highlighted = false;
WeighBridgeCheck.instance.isCheckWeigh = true;
LoadTriggerNextGuide("关闭");
MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick("地磅检查");
}
break;
case ModelType.:
//if (GetComponent<MeshCollider>().enabled == false && MotionEngine.GetModule<ProcessManager>()._currentMode != ProcessMode.考核模式)
// return;
if (!WeighBridgeCheck.instance.isdisplay)
{
UI_Tips.instance.ShowPanel("称重显示屏检查成功!", true);
highlightEffect.highlighted = false;
WeighBridgeCheck.instance.isdisplay = true;
LoadTriggerNextGuide("关闭");
MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick("称重检查");
}
break;
case ModelType.:
//if (GetComponent<MeshCollider>().enabled == false && MotionEngine.GetModule<ProcessManager>()._currentMode != ProcessMode.考核模式)
// return;
if (!UI_Tips.instance.duihua.activeInHierarchy)
{
UI_Tips.instance.duihua.SetActive(true);
UI_Tips.instance.duihua.transform.Find("对话").gameObject.SetActive(true);
highlightEffect.highlighted = false;
// WeighBridgeCheck.instance.isdisplay = true;
LoadTriggerNextGuide();
// MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick("");
}
break;
default:
break;
}
}
public void OnTriggerEnter(Collider other)
{
switch (modelType)
{
case ModelType.None:
break;
case ModelType.:
StartCoroutine(WaitFade(new Vector3(6, 1, -12)));
break;
// case ModelType.地磅:
// StartCoroutine(WaitFade(new Vector3(-15.216f, 1.085f, 6.097f)));
// break;
}
}
/// <summary>
/// 延迟显示黑屏
/// </summary>
/// <returns></returns>
public IEnumerator WaitFade(Vector3 pos)
{
Transform player = GameObject.FindWithTag("Player").transform;
Image bg = player.GetComponentInChildren<Image>();
player.GetComponent<FirstPersonController>().enabled = false;
bg.DOFade(1, 1.9f);
yield return new WaitForSeconds(2f);
bg.DOFade(0, 1.9f);
player.SetLocalPositionAndRotation(pos, Quaternion.Euler(0, -90, 0));
yield return new WaitForSeconds(0.1f);
player.GetComponent<FirstPersonController>().enabled = true;
player.GetComponent<FirstPersonController>().InitController();
LoadTriggerNextGuide(transform.name);
}
}