1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using GameFramework.Event;
- using UnityEngine;
- public class Cool_FaultToolList : MonoBehaviour
- {
- private GameObject hand;
- private GameObject handWithGloves;
- private GameObject gloves;
-
- private GameObject cleaningRod;
- private GameObject refrigerant;
-
- private void Awake()
- {
- hand = this.transform.Find("hand").gameObject;
- handWithGloves = this.transform.Find("handWithGloves").gameObject;
- gloves = this.transform.Find("gloves").gameObject;
- cleaningRod = this.transform.Find("cleaningRod").gameObject;
- refrigerant = this.transform.Find("refrigerant").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);
- cleaningRod.SetActive(true);
- refrigerant.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);
- }
- }
- }
|