123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using GameFramework.Event;
- using UnityEngine;
- public class IT_FaultToolList : MonoBehaviour
- {
- private GameObject hand;
- private GameObject handWithGloves;
- private GameObject gloves;
- private GameObject AntiStaticBag;
- private GameObject screwdriver;
- private GameObject chassisCover;
- private GameObject fan;
- private GameObject ram;
- private GameObject battery;
- private GameObject hardDisk;
- private void Awake()
- {
- hand = this.transform.Find("hand").gameObject;
- handWithGloves = this.transform.Find("handWithGloves").gameObject;
- gloves = this.transform.Find("gloves").gameObject;
- AntiStaticBag = this.transform.Find("AntiStaticBag").gameObject;
- screwdriver = this.transform.Find("screwdriver").gameObject;
- chassisCover = this.transform.Find("chassisCover").gameObject;
- fan = this.transform.Find("fan").gameObject;
- ram = this.transform.Find("ram").gameObject;
- battery = this.transform.Find("battery").gameObject;
- hardDisk = this.transform.Find("hardDisk").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);
- AntiStaticBag.SetActive(false);
- screwdriver.SetActive(true);
- chassisCover.SetActive(false);
- ram.SetActive(false);
- hardDisk.SetActive(false);
- battery.SetActive(false);
- switch (type)
- {
- case 0:
- fan.SetActive(false);
- AntiStaticBag.SetActive(true);
- break;
- case 2: //ram
- ram.SetActive(true);
- break;
- case 3: //hardDisk
- hardDisk.SetActive(true);
- break;
- case 4: //battery
- battery.SetActive(true);
- break;
- default:
- chassisCover.SetActive(false);
- fan.SetActive(true);
- break;
- }
- }
- public void ShowChassisCover()
- {
- chassisCover.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);
- }
- }
- }
|