using System; using System.Collections; using System.Collections.Generic; using GameFramework.Event; using UnityEngine; public class Net_FaultToolList : MonoBehaviour { private GameObject hand; private GameObject handWithGloves; private GameObject gloves; private GameObject screwdriver; private GameObject chassisCover; private GameObject netWordCard; private GameObject lightModel; private GameObject opticalFiber; private void Awake() { hand = this.transform.Find("hand").gameObject; handWithGloves = this.transform.Find("handWithGloves").gameObject; gloves = this.transform.Find("gloves").gameObject; screwdriver = this.transform.Find("screwdriver").gameObject; chassisCover = this.transform.Find("chassisCover").gameObject; netWordCard = this.transform.Find("netWordCard").gameObject; lightModel = this.transform.Find("lightModel").gameObject; opticalFiber = this.transform.Find("opticalFiber").gameObject; ReSetToolList(0); } private void Start() { GameMain.Event.Subscribe(UI_ItemMoveDoneEvent.EventId, OnGetUI_ItemMoveDone); } private void OnDestroy() { if (GameMain.Event.Check(UI_ItemMoveDoneEvent.EventId, OnGetUI_ItemMoveDone)) { GameMain.Event.Unsubscribe(UI_ItemMoveDoneEvent.EventId, OnGetUI_ItemMoveDone); } } //初始化隐藏 戴手套的手、机箱盖 public void ReSetToolList(int type) { hand.SetActive(true); handWithGloves.SetActive(false); gloves.SetActive(true); screwdriver.SetActive(true); chassisCover.SetActive(false); netWordCard.SetActive(false); lightModel.SetActive(false); opticalFiber.SetActive(false); } public void ShowChassisCover() { chassisCover.SetActive(true); } public void ShowNetWordCard() { netWordCard.SetActive(true); } public void ShowLightModel() { lightModel.SetActive(true); } public void ShowOpticalFiber() { opticalFiber.SetActive(true); } private void OnGetUI_ItemMoveDone(object sender,GameEventArgs e) { UI_ItemMoveDoneEvent args = (UI_ItemMoveDoneEvent)e; //合成戴手套的手 bool getHandWithGloves = false; if (args.item_1 == UI_TriggerItemType.hand) { if (args.item_2 == UI_TriggerItemType.gloves) { getHandWithGloves = true; } } else if(args.item_2 == UI_TriggerItemType.hand) { if (args.item_1 == UI_TriggerItemType.gloves) { getHandWithGloves = true; } } if (getHandWithGloves) { hand.SetActive(false); handWithGloves.SetActive(true); gloves.SetActive(false); return; } //拆掉机箱盖 bool getChassisCover = false; if (args.item_1 == UI_TriggerItemType.handWithGloves) { if (args.item_2 == UI_TriggerItemType.chassisCover) { getChassisCover = true; } } else if (args.item_2 == UI_TriggerItemType.handWithGloves) { if (args.item_1 == UI_TriggerItemType.chassisCover) { getChassisCover = true; } } if (getChassisCover) { chassisCover.SetActive(true); } } }