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; /// /// 高亮插件 /// private HighlightEffect highlightEffect; private Framework.Dto.InventoryReversalVoucherAnalyzer returnRevVoucherAnalyzer; /// /// 安全帽箭头 /// public GameObject HatArror; void Start() { //if ((!MotionEngine.GetModule().ExamName.Contains("库存物资报废") || !MotionEngine.GetModule().ExamName.Contains("废旧物资入库")) && modelType == ModelType.地磅 || modelType == ModelType.称重显示屏) //{ // GetComponent().enabled = false; // GetComponent().enabled = false; //} highlightEffect = GetComponent(); if (MotionEngine.GetModule().ExamName == "审核合同变更申请") { returnRevVoucherAnalyzer = (Framework.Dto.InventoryReversalVoucherAnalyzer)MotionEngine.GetModule().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().HandleClick("安全帽"); if (highlightEffect != null) { highlightEffect.SetHighlighted(false); } LoadTriggerNextGuide(); break; case ModelType.电脑键盘: if (ModerController.Instance.iscomputer) return; // if (MotionEngine.GetModule().ExamName == "不良行为处理") // { MotionFramework.MotionEngine.GetModule().HandleClick("电脑组"); // ModerController.Instance.iscomputer = true; // // }else if (MotionEngine.GetModule().ExamName == "违约索赔") // { MotionFramework.MotionEngine.GetModule().HandleClick("电脑组"); // ModerController.Instance.iscomputer = true; // } // else // { UI_Tips.instance.ShowPanel("电脑内网系统正常,键盘鼠标硬件正常!"); ModerController.Instance.iscomputer = true; //领取并佩戴安全帽 MotionFramework.MotionEngine.GetModule().HandleClick("电脑组"); if (MotionEngine.GetModule().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().enabled == false&& MotionEngine.GetModule()._currentMode != ProcessMode.考核模式) // return; if (!WeighBridgeCheck.instance.isCheckWeigh) { UI_Tips.instance.ShowPanel("地磅检查成功!", true); highlightEffect.highlighted = false; WeighBridgeCheck.instance.isCheckWeigh = true; LoadTriggerNextGuide("关闭"); MotionFramework.MotionEngine.GetModule().HandleClick("地磅检查"); } break; case ModelType.称重显示屏: //if (GetComponent().enabled == false && MotionEngine.GetModule()._currentMode != ProcessMode.考核模式) // return; if (!WeighBridgeCheck.instance.isdisplay) { UI_Tips.instance.ShowPanel("称重显示屏检查成功!", true); highlightEffect.highlighted = false; WeighBridgeCheck.instance.isdisplay = true; LoadTriggerNextGuide("关闭"); MotionFramework.MotionEngine.GetModule().HandleClick("称重检查"); } break; case ModelType.人物对话: //if (GetComponent().enabled == false && MotionEngine.GetModule()._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().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; } } /// /// 延迟显示黑屏 /// /// public IEnumerator WaitFade(Vector3 pos) { Transform player = GameObject.FindWithTag("Player").transform; Image bg = player.GetComponentInChildren(); player.GetComponent().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().enabled = true; player.GetComponent().InitController(); LoadTriggerNextGuide(transform.name); } }