243 lines
9.2 KiB
C#
243 lines
9.2 KiB
C#
using DefaultNamespace;
|
|
using DefaultNamespace.ProcessMode;
|
|
using Framework.Manager;
|
|
using MotionFramework;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using static InterfaceManager;
|
|
|
|
/// <summary>
|
|
/// 存储区控制脚本
|
|
/// </summary>
|
|
public class TakePositionController : MonoBehaviour
|
|
{
|
|
public static TakePositionController Instance;
|
|
|
|
/// <summary>
|
|
/// 物资码放
|
|
/// </summary>
|
|
public Button btnMaterialStacking;
|
|
|
|
/// <summary>
|
|
/// 物资码放完毕_确定按钮高亮提示
|
|
/// </summary>
|
|
public Transform btnMaterialStackingHighlightObj;
|
|
|
|
/// <summary>
|
|
/// 上架点位
|
|
/// </summary>
|
|
public List<Transform> TakePositionList = new List<Transform>();
|
|
|
|
/// <summary>
|
|
/// 上架点位列表
|
|
/// </summary>
|
|
public List<TakePosition> takePositionList = new List<TakePosition>();
|
|
/// <summary>
|
|
/// 箭头
|
|
/// </summary>
|
|
public List<GameObject> Arrorow = new List<GameObject>();
|
|
|
|
public GameObject btnShangjia;
|
|
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
btnMaterialStacking = FindObjectByName<Button>("btnMaterialStacking");
|
|
btnMaterialStackingHighlightObj = FindObjectByName<Transform>("btnMaterialStackingHighlightObj");
|
|
}
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
if (btnMaterialStacking != null)
|
|
{
|
|
btnMaterialStacking.onClick.AddListener(() =>
|
|
{
|
|
btnMaterialStacking.enabled = false;
|
|
StartCoroutine(MaterialStacking());
|
|
});
|
|
}
|
|
|
|
takePositionList = transform.GetComponentsInChildren<TakePosition>().ToList();
|
|
|
|
|
|
if (GameManager.Instance.combinedClass.TargetLocation != "")
|
|
{
|
|
for (int i = 0; i < takePositionList.Count; i++)
|
|
{
|
|
//目标点位
|
|
string targetLocation = GameManager.Instance.combinedClass.TargetLocation.Split('-')[0];
|
|
if (takePositionList[i].name.Contains(targetLocation))
|
|
{
|
|
takePositionList[i].GetComponentInChildren<Text>().text = GameManager.Instance.combinedClass.TargetLocation;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 物资上架
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public IEnumerator TakePosition(List<Transform> goods)
|
|
{
|
|
TakePositionList = goods;
|
|
List<CheckGoods> checkGoods = ModerController.Instance.checkGoods;
|
|
checkGoods.ForEach(x => x.OnShelve());
|
|
yield return new WaitForSeconds(1);
|
|
if (TakePositionList.Count > checkGoods.Count)
|
|
{
|
|
for (int i = 0; i < checkGoods.Count; i++)
|
|
{
|
|
if (checkGoods[i].name.Contains("电力电缆"))
|
|
{
|
|
switch (i)
|
|
{
|
|
case 0:
|
|
checkGoods[i].transform.position = TakePositionList[6].position;
|
|
checkGoods[i].transform.eulerAngles = TakePositionList[6].eulerAngles;
|
|
checkGoods[i].gameObject.SetActive(true);
|
|
break;
|
|
case 1:
|
|
checkGoods[i].transform.position = TakePositionList[14].position;
|
|
checkGoods[i].transform.eulerAngles = TakePositionList[14].eulerAngles;
|
|
checkGoods[i].gameObject.SetActive(true);
|
|
break;
|
|
case 2:
|
|
checkGoods[i].transform.position = TakePositionList[18].position;
|
|
checkGoods[i].transform.eulerAngles = TakePositionList[18].eulerAngles;
|
|
checkGoods[i].gameObject.SetActive(true);
|
|
break;
|
|
case 3:
|
|
checkGoods[i].transform.position = TakePositionList[26].position;
|
|
checkGoods[i].transform.eulerAngles = TakePositionList[26].eulerAngles;
|
|
checkGoods[i].gameObject.SetActive(true);
|
|
break;
|
|
case 4:
|
|
checkGoods[i].transform.position = TakePositionList[2].position;
|
|
checkGoods[i].transform.eulerAngles = TakePositionList[2].eulerAngles;
|
|
checkGoods[i].gameObject.SetActive(true);
|
|
break;
|
|
case 5:
|
|
checkGoods[i].transform.position = TakePositionList[12].position;
|
|
checkGoods[i].transform.eulerAngles = TakePositionList[12].eulerAngles;
|
|
checkGoods[i].gameObject.SetActive(true);
|
|
break;
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
checkGoods[i].transform.position = TakePositionList[i].position;
|
|
checkGoods[i].transform.eulerAngles = TakePositionList[i].eulerAngles;
|
|
checkGoods[i].gameObject.SetActive(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("不可用办理实物退库") ||
|
|
MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("废旧物资入库"))
|
|
{
|
|
btnMaterialStacking.transform.parent.gameObject.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
btnMaterialStacking.transform.parent.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 物资码放
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private IEnumerator MaterialStacking()
|
|
{
|
|
yield return new WaitForSeconds(0.1f);
|
|
List<string> materialList = new List<string>();
|
|
List<CheckGoods> checkGoods = ModerController.Instance.checkGoods;
|
|
for (int i = 0; i < checkGoods.Count; i++)
|
|
{
|
|
string isTask = checkGoods[i].IsTask ? "true" : "false";
|
|
materialList.Add(isTask);
|
|
}
|
|
|
|
yield return new WaitForSeconds(0.1f);
|
|
|
|
|
|
if (!MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("库存物资报废流程"))
|
|
{
|
|
bool IsTask = MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick(materialList);
|
|
}
|
|
|
|
btnMaterialStacking.transform.parent.gameObject.SetActive(false);
|
|
checkGoods.ForEach(x => x.OnGoodsCode());
|
|
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("到货验收入库") ||
|
|
MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("调拨物资入库") ||
|
|
MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("退料物资入库") ||
|
|
MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("办理实物退库") ||
|
|
MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("退出退役代保管入库"))
|
|
{
|
|
TutorialGuideManager.Instance.TriggerNextGuide();
|
|
}
|
|
else
|
|
{
|
|
TutorialGuideManager.Instance.ShowMaskdon_tNext();
|
|
}
|
|
|
|
btnMaterialStacking.enabled = true;
|
|
}
|
|
public void Shangjia()
|
|
{
|
|
if (MotionFramework.MotionEngine.GetModule<ProcessManager>()._currentMode == ProcessMode.教学模式 ||
|
|
MotionFramework.MotionEngine.GetModule<ProcessManager>()._currentMode == ProcessMode.课程预览)
|
|
{
|
|
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("代保管物资出库"))
|
|
{
|
|
btnShangjia.SetActive(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void Xiajia()
|
|
{
|
|
if (MotionFramework.MotionEngine.GetModule<ProcessManager>()._currentMode == ProcessMode.教学模式 ||
|
|
MotionFramework.MotionEngine.GetModule<ProcessManager>()._currentMode == ProcessMode.课程预览)
|
|
{
|
|
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("代保管物资出库"))
|
|
{
|
|
btnShangjia.SetActive(false);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 物资码放 显示引导(外部调用)
|
|
/// </summary>
|
|
public void GuideShow()
|
|
{
|
|
if (MotionFramework.MotionEngine.GetModule<ProcessManager>()._currentMode == ProcessMode.教学模式 ||
|
|
MotionFramework.MotionEngine.GetModule<ProcessManager>()._currentMode == ProcessMode.课程预览)
|
|
{
|
|
//获取当前目标点位
|
|
//string guideName = GameManager.Instance.combinedClass.TargetLocation;
|
|
string guideName = GameManager.Instance.combinedClass.TargetLocation.Split('-')[0];
|
|
TakePosition takePosition = takePositionList.Find(x => x.name.Contains(guideName));
|
|
|
|
//TakePosition takePosition = takePositionList.Find(x => x.name.Contains(guideName));
|
|
if (takePosition != null)
|
|
{
|
|
takePosition.guide.SetActive(true);
|
|
}
|
|
for (int i = 0; i < Arrorow.Count; i++)
|
|
{
|
|
if (Arrorow[i].name.Contains(guideName))
|
|
{
|
|
Arrorow[i].SetActive(true);
|
|
}
|
|
}
|
|
btnMaterialStackingHighlightObj.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
} |