373 lines
14 KiB
C#
373 lines
14 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// 直接接入式电能计量装置 步骤状态设置
|
|
/// </summary>
|
|
public class StepState_2002 : StepState
|
|
{
|
|
/// <summary>
|
|
/// 现场场景中的特殊物体控制
|
|
/// </summary>
|
|
private Device_Control_2002 device_Control;
|
|
private void Awake()
|
|
{
|
|
steps.Add(1, E_SceneType.Office);
|
|
steps.Add(2, E_SceneType.Office);
|
|
}
|
|
|
|
public override void SetDeviceControl(Device_Control device_Control)
|
|
{
|
|
this.device_Control = (Device_Control_2002)device_Control;
|
|
}
|
|
public override void SetOrigonFaultOption()
|
|
{
|
|
}
|
|
/// <summary>
|
|
/// 从场景第一步会依次往下执行,直到指定步骤
|
|
/// </summary>
|
|
/// <param name="num"></param>
|
|
public override void SetStepState(int num, int lastNum)
|
|
{
|
|
Debug.Log("切换步骤" + num);
|
|
//删除手里的东西
|
|
LiveSceneManager.Instance?.OnCheckSubProcess();
|
|
|
|
if (num == 1)
|
|
{
|
|
//办公室场景首个步骤
|
|
//查看任务单
|
|
OfficeManager.Instance.mobileController.downIndex = 0;
|
|
PacksackBagMgr.Instance.ClearAllData();
|
|
GameManager.Instance.ClearTicketsInfo();//HQB 清空工作票
|
|
}
|
|
else if (num == 2)
|
|
{
|
|
//工作预约
|
|
OfficeManager.Instance.mobileController.downIndex = 1;
|
|
|
|
}
|
|
else if (num == 3)
|
|
{
|
|
//办理工作票
|
|
OfficeManager.Instance.mobileController.downIndex = 2;
|
|
|
|
}
|
|
else if (num == 4)
|
|
{
|
|
//填写装拆工单
|
|
|
|
}
|
|
else if (num == 5)
|
|
{
|
|
//场景首个步骤
|
|
//正确着装
|
|
|
|
TooRoomMannger.Instance.SetFirstPersonTransform(new Vector3(8.268f, 1.01f, 4.011f), new Vector3(0, 180, 0));
|
|
TooRoomMannger.Instance.cabinetController.Init();
|
|
//清空背包
|
|
TooRoomMannger.Instance.CreateTool();
|
|
PacksackBagMgr.Instance.ClearAllToolAndDiveceAndMaterial();
|
|
TooRoomMannger.Instance.CheckWearByWearDic();
|
|
//完成第一步点击去工具间
|
|
if (num == lastNum)
|
|
{
|
|
E_SceneType curret = GameManager.RunModelMgr.SceneType;
|
|
GameManager.RunModelMgr.SceneType = E_SceneType.Office;
|
|
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID("工具间按钮", true) == 0)
|
|
{
|
|
Debug.Log("工具间按钮已自动点击");
|
|
}
|
|
GameManager.RunModelMgr.SceneType = curret;
|
|
}
|
|
}
|
|
else if (num == 6)
|
|
{
|
|
|
|
//选取工器具
|
|
|
|
TooRoomMannger.Instance.SetFirstPersonTransform(new Vector3(2.2f, 1.01f, 4.011f), new Vector3(0, 180, 0));
|
|
|
|
//服装拿到背包
|
|
List<Tool_SelectComponent> items = TooRoomMannger.Instance.GetItemInfoByName(new List<string> { "国网安全帽", "工作服", "编织手套", "绝缘靴","护目镜" });
|
|
items.ForEach(item =>
|
|
{
|
|
PacksackBagMgr.Instance.AddOneToolOrMater(item.itemInfo);
|
|
Destroy(item.gameObject);
|
|
//穿上
|
|
PacksackBagMgr.Instance.WearItemState(item.itemInfo, true);
|
|
});
|
|
}
|
|
else if (num == 7)
|
|
{
|
|
//场景首个步骤
|
|
//与客户沟通
|
|
|
|
|
|
//移动任务位置
|
|
LiveSceneManager.Instance.SetFirstPersonTransform(new Vector3(-43.02f, 1.07f, -90.08f), new Vector3(0, -181.643f, 0));
|
|
//完成第一步点击去工具间
|
|
if (num == lastNum)
|
|
{
|
|
E_SceneType curret = GameManager.RunModelMgr.SceneType;
|
|
GameManager.RunModelMgr.SceneType = E_SceneType.ToolRoom;
|
|
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID("现场按钮", true) == 0)
|
|
{
|
|
Debug.Log("现场按钮已自动点击");
|
|
}
|
|
GameManager.RunModelMgr.SceneType = curret;
|
|
}
|
|
|
|
|
|
#region 背包重置并带上正确装备
|
|
|
|
//清空背包数据
|
|
PacksackBagMgr.Instance.ClearAllData();
|
|
////生成服装
|
|
//List<ItemInfo> items = ToolAndmaterialMgr.Instance.CreateItemInfoByName(new List<string> { "国网安全帽", "工作服", "编织手套", "绝缘靴", "护目镜" });
|
|
////放入背包
|
|
//items.ForEach(item =>
|
|
//{
|
|
// PacksackBagMgr.Instance.AddOneToolOrMater(item);
|
|
// //穿上
|
|
// PacksackBagMgr.Instance.WearItemState(item, true);
|
|
//});
|
|
//生成工具
|
|
List<ItemInfo> items2 = ToolAndmaterialMgr.Instance.CreateItemInfoByName(new List<string> { "剥线钳", "绝缘螺丝刀", "验电笔", "工作证", "盒装封印", "绝缘胶带", "三相四线费控智能电能表","围栏", "工作牌_从此进出", "工作牌_在此工作" });
|
|
items2.ForEach(item =>
|
|
{
|
|
PacksackBagMgr.Instance.AddOneToolOrMater(item);
|
|
});
|
|
|
|
|
|
#endregion
|
|
|
|
//还原柜子
|
|
device_Control.Init();
|
|
|
|
//还原npc对话
|
|
LiveSceneManager.Instance.transform.GetComponent<NPC_Attach10002_2002>().Init();
|
|
}
|
|
else if (num == 8)
|
|
{
|
|
//班前会
|
|
|
|
//与客户沟通结束
|
|
LiveSceneManager.Instance.transform.GetComponent<NPC_Attach10002_2002>().custom.spriteRenderer.gameObject.SetActive(false);
|
|
LiveSceneManager.Instance.transform.GetComponent<NPC_Attach10002_2002>().customIndex = 1;
|
|
}
|
|
else if (num == 9)
|
|
{
|
|
//三步验电
|
|
|
|
//移动任务位置
|
|
LiveSceneManager.Instance.SetFirstPersonTransform(new Vector3(-42.91014f, 0.8813875f, -99.69319f), new Vector3(0, -180.343f, 0));
|
|
//班前会结束
|
|
LiveSceneManager.Instance.transform.GetComponent<NPC_Attach10002_2002>().header.spriteRenderer.gameObject.SetActive(false);
|
|
LiveSceneManager.Instance.transform.GetComponent<NPC_Attach10002_2002>().headTalkIndex = 1;
|
|
//围栏生成
|
|
device_Control.trigger_weiLans.ForEach(trigger =>
|
|
{
|
|
GameObject weilan = GameObject.Instantiate<GameObject>(Resources.Load<GameObject>("Prefabs/Objects/Tools/围栏"));
|
|
Tool_Fence fence = weilan.GetComponent<Tool_Fence>();
|
|
fence.SetInstallState(trigger, isinstalled =>
|
|
{
|
|
if (isinstalled)
|
|
{
|
|
device_Control.tool_Fences.Add(fence);
|
|
}
|
|
else
|
|
{
|
|
device_Control.tool_Fences.Remove(fence);
|
|
}
|
|
});
|
|
});
|
|
//生成工作牌
|
|
if (device_Control.current_workCard_InAndOut == null)
|
|
{
|
|
GameObject workinout = GameObject.Instantiate<GameObject>(Resources.Load<GameObject>("Prefabs/Objects/Tools/工作牌_从此进出"));
|
|
device_Control.current_workCard_InAndOut = workinout.transform.GetComponent<Tool_WorkCard_InAndOut>();
|
|
device_Control.current_workCard_InAndOut.SetInstallState(device_Control.workCard_从此进出_trigger);
|
|
}
|
|
if (device_Control.current_workCard_Workthere == null)
|
|
{
|
|
GameObject workthere = GameObject.Instantiate<GameObject>(Resources.Load<GameObject>("Prefabs/Objects/Tools/工作牌_在此工作"));
|
|
device_Control.current_workCard_Workthere = workthere.transform.GetComponent<Tool_WorkCard_workthere>();
|
|
device_Control.current_workCard_Workthere.SetInstallState(device_Control.workCard_在此工作_trigger);
|
|
}
|
|
}
|
|
else if (num == 10)
|
|
{
|
|
//接线检查并断开电源验电
|
|
|
|
//门开着
|
|
device_Control.cabinetDoor.SetState(true);
|
|
device_Control.door_screw.isInstall = false;
|
|
device_Control.door_screw.transform.localPosition = new Vector3(device_Control.door_screw.transform.localPosition.x, device_Control.door_screw.initPostionY-0.03f, device_Control.door_screw.transform.localPosition.z);
|
|
device_Control.door_seal.isCut = true;
|
|
device_Control.door_seal.gameObject.SetActive(false);
|
|
device_Control.door_cover.SetState(true);
|
|
|
|
|
|
//盖子拆下来
|
|
device_Control.meteringDevice.CoverUnstallState();
|
|
//封印拆掉
|
|
device_Control.meteringDevice.CoverSealUninstallState();
|
|
}
|
|
else if (num == 11)
|
|
{
|
|
//核对和抄录计量设备信息
|
|
|
|
//电源断开了
|
|
device_Control.inSwitch.CloseState();
|
|
device_Control.outSwitch.CloseState();
|
|
device_Control.p2Switch.CloseState();
|
|
//刷新带电状态
|
|
device_Control.CheckHasElectricity();
|
|
//npc断电聊天
|
|
LiveSceneManager.Instance.transform.GetComponent<NPC_Attach10002_2002>().customIndex = 2;
|
|
}
|
|
else if (num == 12)
|
|
{
|
|
//拆除电能计量装置
|
|
//铭牌已读取
|
|
device_Control.meteringDevice.namePlate.isChecked = true;
|
|
}
|
|
else if (num == 13)
|
|
{
|
|
//安装电能表
|
|
|
|
//拆除电能表
|
|
DestroyImmediate(device_Control.meteringDevice.gameObject);
|
|
device_Control.meteringDevice = null;
|
|
//杂物显示
|
|
device_Control.sundries.gameObject.SetActive(true);
|
|
|
|
//电能表接线取下了
|
|
device_Control.jieXian_lines.ForEach(line =>
|
|
{
|
|
line.SetConenctState(false);
|
|
});
|
|
//集线器的线取下来了
|
|
device_Control.collect_lines.ForEach(line =>
|
|
{
|
|
line.SetConenctState(false);
|
|
});
|
|
//刷新带电状态
|
|
device_Control.CheckHasElectricity();
|
|
}
|
|
else if (num == 14)
|
|
{
|
|
//现场通电及检查
|
|
|
|
//电能表安装了
|
|
if (device_Control.meteringDevice == null)
|
|
{
|
|
device_Control.meteringDevice = GameObject.Instantiate<GameObject>(Resources.Load<GameObject>("Prefabs/Objects/Tools/三相四线费控智能电能表")).GetComponent<Device_3Phase4WireMeter>();
|
|
device_Control.meteringDevice.cover.openLocalPos = new Vector3(0.295f, 0.121f, -0.067f);
|
|
device_Control.meteringDevice.transform.GetComponent<BoxCollider>().enabled = false;
|
|
device_Control.meteringDevice.SetAddState(device_Control.dianTrigger, new Vector3(-0.02999878f, -0.028f, 0.168f));
|
|
device_Control.meteringDevice.screemControl.ShowPanel(new List<ScreenType> { ScreenType.时间, ScreenType.电量正向有功谷, ScreenType.电量正向有功峰, ScreenType.电量正向有功总 });
|
|
//接线关联螺丝
|
|
device_Control.SetLineScrew();
|
|
//添加螺丝拆装回调
|
|
device_Control.meteringDevice.jieXian_screws.ForEach(screw =>
|
|
{
|
|
screw.AddinstallAction(isinstalled =>
|
|
{
|
|
//刷新带电状态
|
|
device_Control.CheckHasElectricity();
|
|
});
|
|
|
|
//改变验电角度
|
|
screw.TestPenAng = screw.installPos.localEulerAngles + new Vector3(0, 180, 0); ;
|
|
});
|
|
//固定螺丝回调
|
|
device_Control.meteringDevice.fix_screw_left.AddinstallAction(isinstall => { device_Control.Check电能表TriggerShow(); });
|
|
device_Control.meteringDevice.fix_screw_right.AddinstallAction(isinstall => { device_Control.Check电能表TriggerShow(); });
|
|
//固定螺丝拧上
|
|
device_Control.meteringDevice.FixScrewInstall();
|
|
//接线螺丝拧上
|
|
device_Control.meteringDevice.JieXianScrewInstallState();
|
|
}
|
|
|
|
|
|
|
|
//隔离板盖上
|
|
device_Control.meteringDevice.isolationBoard.SetState(false);
|
|
//电能表接线连上了
|
|
device_Control.jieXian_lines.ForEach(line =>
|
|
{
|
|
line.SetConenctState(true);
|
|
});
|
|
//采集器线连上了
|
|
device_Control.collect_lines.ForEach(line =>
|
|
{
|
|
line.SetConenctState(true);
|
|
});
|
|
//刷新带电状态
|
|
device_Control.CheckHasElectricity();
|
|
}
|
|
else if (num == 15)
|
|
{
|
|
//实施封印
|
|
|
|
//开关打开了
|
|
device_Control.inSwitch.OpenState();
|
|
device_Control.outSwitch.OpenState();
|
|
device_Control.p2Switch.OpenState();
|
|
//刷新带电状态
|
|
device_Control.CheckHasElectricity();
|
|
//盖子盖上
|
|
device_Control.meteringDevice.CoverInstallState();
|
|
}
|
|
else if (num == 16)
|
|
{
|
|
//清理现场
|
|
device_Control.meteringDevice.cover.cover_seal_Left.Install();
|
|
device_Control.meteringDevice.cover.cover_seal_Right.Install();
|
|
}
|
|
else if (num == 17)
|
|
{
|
|
//现场完工
|
|
|
|
//还原柜门
|
|
device_Control.sundries.gameObject.SetActive(false);
|
|
device_Control.cabinetDoor.SetState(false);
|
|
device_Control.door_cover.SetState(false);
|
|
device_Control.door_screw.isInstall = true;
|
|
device_Control.door_screw.transform.localPosition = new Vector3(device_Control.door_screw.transform.localPosition.x, device_Control.door_screw.initPostionY, device_Control.door_screw.transform.localPosition.z);
|
|
device_Control.door_seal.isCut = false;
|
|
device_Control.door_seal.gameObject.SetActive(true);
|
|
|
|
//删除围栏
|
|
device_Control.tool_Fences.ForEach(fence =>
|
|
{
|
|
DestroyImmediate(fence.gameObject);
|
|
});
|
|
device_Control.tool_Fences.Clear();
|
|
|
|
//删除工作牌
|
|
if (device_Control.current_workCard_InAndOut != null)
|
|
{
|
|
DestroyImmediate(device_Control.current_workCard_InAndOut.gameObject);
|
|
device_Control.current_workCard_InAndOut = null;
|
|
}
|
|
if (device_Control.current_workCard_Workthere != null)
|
|
{
|
|
DestroyImmediate(device_Control.current_workCard_Workthere.gameObject);
|
|
device_Control.current_workCard_Workthere = null;
|
|
}
|
|
}
|
|
else if (num == 18)
|
|
{
|
|
//工作票终结
|
|
|
|
//客户完工
|
|
LiveSceneManager.Instance.transform.GetComponent<NPC_Attach10002_2002>().customIndex = 3;
|
|
}
|
|
}
|
|
}
|