Cool_FaultToolList.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using GameFramework.Event;
  5. using UnityEngine;
  6. public class Cool_FaultToolList : MonoBehaviour
  7. {
  8. private GameObject hand;
  9. private GameObject handWithGloves;
  10. private GameObject gloves;
  11. private GameObject cleaningRod;
  12. private GameObject refrigerant;
  13. private void Awake()
  14. {
  15. hand = this.transform.Find("hand").gameObject;
  16. handWithGloves = this.transform.Find("handWithGloves").gameObject;
  17. gloves = this.transform.Find("gloves").gameObject;
  18. cleaningRod = this.transform.Find("cleaningRod").gameObject;
  19. refrigerant = this.transform.Find("refrigerant").gameObject;
  20. ReSetToolList(0);
  21. }
  22. private void Start()
  23. {
  24. //GameMain.Event.Subscribe(UI_ItemMoveDoneEvent.EventId, OnGetUI_ItemMoveDone);
  25. }
  26. private void OnDestroy()
  27. {
  28. // if (GameMain.Event.Check(UI_ItemMoveDoneEvent.EventId, OnGetUI_ItemMoveDone))
  29. // {
  30. // GameMain.Event.Unsubscribe(UI_ItemMoveDoneEvent.EventId, OnGetUI_ItemMoveDone);
  31. // }
  32. }
  33. //初始化隐藏 戴手套的手、机箱盖
  34. public void ReSetToolList(int type)
  35. {
  36. hand.SetActive(true);
  37. handWithGloves.SetActive(false);
  38. //gloves.SetActive(true);
  39. cleaningRod.SetActive(true);
  40. refrigerant.SetActive(true);
  41. }
  42. private void OnGetUI_ItemMoveDone(object sender,GameEventArgs e)
  43. {
  44. UI_ItemMoveDoneEvent args = (UI_ItemMoveDoneEvent)e;
  45. //合成戴手套的手
  46. bool getHandWithGloves = false;
  47. if (args.item_1 == UI_TriggerItemType.hand)
  48. {
  49. if (args.item_2 == UI_TriggerItemType.gloves)
  50. {
  51. getHandWithGloves = true;
  52. }
  53. }
  54. else if(args.item_2 == UI_TriggerItemType.hand)
  55. {
  56. if (args.item_1 == UI_TriggerItemType.gloves)
  57. {
  58. getHandWithGloves = true;
  59. }
  60. }
  61. if (getHandWithGloves)
  62. {
  63. hand.SetActive(false);
  64. handWithGloves.SetActive(true);
  65. gloves.SetActive(false);
  66. }
  67. }
  68. }