123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using UnityEngine;
- using UnityTemplateProjects;
- using static DeMaConfig;
- using static InitTapList;
- public class GameManager : MonoBehaviour
- {
- public DeMaConfig config;
- public SimpleCameraController smp;
- [Serializable]
- public enum TuBiaoType
- {
- [ChineseDescription("总用电量")]
- 总用电量 =10001,
- [ChineseDescription("设备报警率")]
- 设备报警率=10002,
- [ChineseDescription("今日燃气流量")]
- 今日燃气流量=10003,
- [ChineseDescription("累计燃气用量")]
- 累计燃气用量=10004,
- [ChineseDescription("科技设备在线率")]
- 科技设备在线率 =20001,
- [ChineseDescription("科技设备利用率")]
- 科技设备利用率=20002,
- [ChineseDescription("工业设备在线率")]
- 工业设备在线率 =30001,
- [ChineseDescription("工业设备利用率")]
- 工业设备利用率=30002,
- }
- [Serializable]
- public enum GameObjectType
- {
- [ChineseDescription("园区")]
- 园区 =1,
- [ChineseDescription("科技车间")]
- 科技车间=2,
- [ChineseDescription("工业车间")]
- 工业车间=3,
- [ChineseDescription("电力")]
- 电力=4,
- [ChineseDescription("其他")]
- 其他=5,
- }
-
- // 定义枚举
- [Serializable]
- public enum TapName
- {
- [ChineseDescription("园区总览")]
- 园区总览=10001,
- [ChineseDescription("德马科技车间")]
- 德马科技车间=10002,
- [ChineseDescription("德马工业车间")]
- 德马工业车间=10003,
- [ChineseDescription("五期智慧工厂")]
- 五期智慧工厂=10004,
- [ChineseDescription("五期综合大楼")]
- 五期综合大楼=10005,
- [ChineseDescription("车间总览")]
- 科技车间总览=20001,
- [ChineseDescription("AMADA数控冲床")]
- AMADA数控冲床=20002,
- [ChineseDescription("1#AMADA数控折弯机")]
- AMADA数控折弯机1=20003,
- [ChineseDescription("2#AMADA数控折弯机")]
- AMADA数控折弯机2=20004,
- [ChineseDescription("数控折弯机")]
- 数控折弯机=20005,
- [ChineseDescription("电液伺服数控折弯机")]
- 电液伺服数控折弯机=20006,
- [ChineseDescription("电液伺服折弯机")]
- 电液伺服折弯机=20007,
- [ChineseDescription("百超激光切割机")]
- 百超激光切割机=20008,
- [ChineseDescription("辊轧冲")]
- 辊轧冲=20009,
- [ChineseDescription("数控带锯床")]
- 数控带锯床=20010,
- [ChineseDescription("涂装(生产线)系统")]
- 涂装生产线系统=20011,
- [ChineseDescription("抛丸机")]
- 抛丸机=20012,
- [ChineseDescription("车间总览")]
- 工业车间总览=30001,
- [ChineseDescription("1#激光切管倒角一体机")]
- 激光切管倒角一体机1=30002,
- [ChineseDescription("1#S11轴切割倒角冲耳机一体机")]
- S11轴切割倒角冲耳机一体机1=30003,
- [ChineseDescription("1#联线自动装配机")]
- 联线自动装配机1=30004,
- [ChineseDescription("2#激光切管倒角一体机")]
- 激光切管倒角一体机2=30005,
- [ChineseDescription("2#S11轴切割倒角冲耳机一体机")]
- S11轴切割倒角冲耳机一体机2=30006,
- [ChineseDescription("2#联线自动装配机")]
- 联线自动装配机2=30007,
- [ChineseDescription("3#激光切管倒角一体机")]
- 激光切管倒角一体机3=30008,
- [ChineseDescription("3#S11轴切割倒角冲耳机一体机")]
- S11轴切割倒角冲耳机一体机3=30009,
- [ChineseDescription("3#联线自动装配机")]
- 联线自动装配机3=30010,
- [ChineseDescription("15轴加工一体机")]
- 十五轴加工一体机=30011,
- [ChineseDescription("科技一车间")]
- 科技一车间=11001,
- [ChineseDescription("科技二车间")]
- 科技二车间=11002,
- [ChineseDescription("科技三车间")]
- 科技三车间=11003,
- [ChineseDescription("科技五车间")]
- 科技五车间=11004,
- [ChineseDescription("工业二期")]
- 工业二期=11005,
- [ChineseDescription("工业三期(1楼)")]
- 工业三期1=11006,
- [ChineseDescription("工业三期(2楼)")]
- 工业三期2=11007,
- [ChineseDescription("工业四期")]
- 工业四期=11008,
- [ChineseDescription("工业办公楼")]
- 工业办公楼=11009,
- [ChineseDescription("创新办公楼")]
- 创新办公楼=11010,
-
- }
- public static GameManager Instance;
- public void Awake() {
- Instance =this;
- for(var i=0;i<wlist.Count;i++)
- {
- wlist[i].GetComponent<GameType>().init();
- }
- }
- public List<GameObject> wlist;
- public List<GameObject> dlist;
- public List<GameObject> keji;
- public List<GameObject> gongye;
- void showkeji()
- {
- LoadModelAB.ModelDic["工业车间"].SetActive(false);
- LoadModelAB.ModelDic["科技车间"].SetActive(true);
- }
- void showgongye()
- {
- LoadModelAB.ModelDic["科技车间"].SetActive(false);
- LoadModelAB.ModelDic["工业车间"].SetActive(true);
- }
- void showyuanqu()
- {
- LoadModelAB.ModelDic["科技车间"].SetActive(true);
- LoadModelAB.ModelDic["工业车间"].SetActive(true);
- }
- public void showW(GameObjectType gameObjectType,TapName tapName)
- {
- if(LoadModelAB.ModelDic.ContainsKey("科技车间")&&LoadModelAB.ModelDic.ContainsKey("工业车间"))
- {
- switch(tapName)
- {
- case TapName.园区总览:
- Invoke("showyuanqu",1f);
- break;
- case TapName.德马工业车间:
- Invoke("showkeji",1f);
- break;
- case TapName.德马科技车间:
- Invoke("showgongye",1f);
- break;
- }
- }
- switch(gameObjectType)
- {
- case GameObjectType.园区:
- for(var i=0;i<wlist.Count;i++)
- {
- if(wlist[i].GetComponent<GameType>().tapName==tapName)
- {
- wlist[i].SetActive(true);
- }
- else
- {
- wlist[i].SetActive(false);
- }
- }
- for(var i=0;i<dlist.Count;i++)
- {
- dlist[i].SetActive(TapName.园区总览==tapName);
- }
- SimpleCameraController.smallclickct = 3;
- break;
- case GameObjectType.科技车间:
- keji[0].SetActive(tapName == TapName.科技车间总览);
- keji[1].SetActive(tapName != TapName.科技车间总览);
- for(var i=0;i<dlist.Count;i++)
- {
- dlist[i].SetActive(false);
- }
- if(tapName != TapName.科技车间总览)
- {
- SimpleCameraController.smallclickct = 2;
- }else
- {
- SimpleCameraController.smallclickct = 3;
- }
- break;
- case GameObjectType.工业车间:
- gongye[0].SetActive(tapName == TapName.工业车间总览);
- gongye[1].SetActive(tapName != TapName.工业车间总览);
- for(var i=0;i<dlist.Count;i++)
- {
- dlist[i].SetActive(false);
- }
- if(tapName != TapName.工业车间总览)
- {
- SimpleCameraController.smallclickct = 2;
- }else
- {
- SimpleCameraController.smallclickct = 3;
- }
- break;
- case GameObjectType.电力:
- for(var i=0;i<dlist.Count;i++)
- {
- if(dlist[i].GetComponent<GameType>().tapName==tapName)
- {
- dlist[i].SetActive(true);
- }
- else
- {
- dlist[i].SetActive(false);
- }
- }
- SimpleCameraController.smallclickct = 3;
- break;
- }
- smp.initpos();
- }
- public Camera cam;
- GameObject hitGo;
- void Update()
- {
- Ray ray = cam.ScreenPointToRay(Input.mousePosition); // 在鼠标点击位置创建一条射线
- RaycastHit hit; // 用于存储碰撞信息的结构体
- if (Physics.Raycast(ray, out hit)) // 进行射线检测
- {
- if (Input.GetMouseButtonDown(0)) // 当鼠标左键点击时
- {
- Debug.Log("点击物体: " + hit.transform.gameObject.name); // 输出碰撞的物体名称
- }
- else
- {
- if(hitGo)
- {
- if(hitGo.name!=hit.transform.gameObject.name)
- {
- hitGo = hit.transform.gameObject;
- Debug.Log("exit物体: " + hitGo.name); // 输出碰撞的物体名称
- Debug.Log("enter物体: " +hitGo.name); // 输出碰撞的物体名称
- }
- }
- else
- {
- hitGo = hit.transform.gameObject;
- Debug.Log("enter物体: " + hitGo.name); // 输出碰撞的物体名称
- }
- }
- }
- else
- {
- if(hitGo)
- {
- Debug.Log("exit物体: " + hitGo.name); // 输出碰撞的物体名称
- hitGo=null;
- }
- }
-
- }
- public string getID(TapName tapName)
- {
- for (int i = 0;i<GameManager.Instance.config.TaskList.Count;i++)
- {
- if(tapName == GameManager.Instance.config.TaskList[i].type)
- {
- return GameManager.Instance.config.TaskList[i].ID;
- }
- }
- return "";
- }
- }
|